Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

MaxDB Connection

0.00/5 (No votes)
22 Jan 2008 1  
How to connect ot MaxDB with c#

Introduction

I have noticed a very small amount of support available for MaxDB. I have had the need to interface a dot net application to MaxDB for for the following reasons:

1. MaxDB is our SAP backend and I can host my database on the SAP server eliminating the need to me to do further maintenace on a new db.

2. Performance of the SAP database server.

3. The database is free :)


Using the code

The code is pritty simple. All the application does is connect ot a MaxDB database.

SQLConnection is obviously out of the question as it only connects to a SQL server, So I have used the next best thing. Odbc connection. The reason for this is I can have my data access seperate from my business logic and as such still you data tables and adapters.

OdbcConnection con = new OdbcConnection("driver=sap db;servernode=" + txtServer.Text + ";serverdb=" + txtDatabase.Text +
                                                    ";uid=" + txtUserName.Text.ToUpper() + ";pwd=" + txtPassword.Text.ToUpper());
            try
            {
                con.Open();
                MessageBox.Show("Successfully connected to Database");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            } 


Hope this helps someone ... basically all it is is a connection string for MaxDB.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here