Showing posts with label styring. Show all posts
Showing posts with label styring. Show all posts

Wednesday, March 21, 2012

ODBC connect styring does not work

Porting a C Db-library program to ODBC connectivity for Sql Server 2000 SP4.When SQLDriverConnect(hdbc, GetDesktopWindow(), "DSN=HOST_ODBC_DB;UIDDBMS=usercode2;PWDDBMS=password2;", SQL_NTS, NULL, 0, NULL, SQL_DRIVER_COMPLETE) is used, a dialog window pops up. I enter the password and successfully connect to Sql Server 2000. Of course the usage of SQL_DRIVER_COMPLETE is causing the above "UIDDBMS=usercode2;PWDDBMS=password2;" to be ignored in the connect string.If instead the above connect string is used with SQL_DRIVER_NOPROMPT rather than SQL_DRIVER_COMPLETE the following errors are received:[28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. (18452)[01S00] [Microsoft][ODBC SQL Server Driver]Invalid connection string attribute (0)What is causing this?What is the server working on, only on Windows Authentication or on Mixed Authentication, the (null) indicated that its using Windows Authentication but did not get the credentials from the client because either the client passed SQL Server credentials or the Windows account could not be passed.

HTH, jens Suessmeyer.

http://www.sqlserver2005.de
|||

The database server is configured for both Windows and database server authentication. The original Db-library C program version can connect using either authentication type.

The ODBC ported C program version can connect using a Windows authentication connect string with: SQLDriverConnect(hdbc, GetDesktopWindow(), "DSN=host_ODBC", SQL_NTS, NULL, 0, NULL, SQL_DRIVER_NOPROMPT.

It cannot connect using a database server authentication connect string of "DSN=host_ODBC_DB;UIDDBMS=usercode2;PWDDBMS=password2".

The host_ODBC odbc data source was configured for Windows authentication. The host_ODBC_DB odbc data source was configured for database server authentication.

Why does database server authentication fail?|||

Which ODBC driver do you use?

Can you try using "UID" and PWD" instead of "UIDDBMS" and "UIDPWD"?


This posting is provided "AS IS" with no warranties, and confers no rights.