MaxDB Connection






1.57/5 (3 votes)
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.