Hello,
after i successfully installed a SAPDB (7.4.3) server and created a database instance (Demo Database "Small", created with the Database Manager GUI) i'm now in trouble with connection to the database from C# via ODBC.
SAP DB ODBC Driver was installed by the server setup (profile "all"). I created a ODBC data source (SAP DB) called "SAPDB", Database "Small" and left Server emtpy because it's the same host. So far i think this should be correct.
Now i created a C# Project in VS2005:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.Odbc; using System.Drawing; using System.Text; using System.Windows.Forms; namespace SAPDB_Connector { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btnConnect_Click(object sender, EventArgs e) { string strConn = "DSN=SAPDB;UID=DBA;PWD=admin"; IDbConnection conn = new OdbcConnection(strConn); conn.Open(); IDbCommand cmd = conn.CreateCommand(); cmd.CommandText = "SELECT owner,tablename,type,tabletype FROM tables"; IDataReader reader = cmd.ExecuteReader(); try { while (reader.Read()) { int n = reader.FieldCount; MessageBox.Show("Got something!!", "Yeah", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } finally { reader.Close(); conn.Close(); } } } }
Via the SQL Studio i can connect to the database "Small" with user "DBA" an password "admin", so i'm trying this here to. But at "conn.Open();" i get the following error:
ERROR [28000] [SAP AG][SQLOD32 DLL][SAP DB] Invalid authorization specification;-4008 POS(1) Unknown user name/password combination
Why? There is no wrong or unknown username /password combinatin because this login is working with SQL Studio.
Any ideas??
Greetings
Michael
Edited by: Michael Hilgers on Jan 30, 2008 9:23 AM