[unixODBC-dev] Connection to MS-SQL

Alejandro Rotolo arotolo at girmet.ru
Sat Jul 17 12:39:16 BST 2004


Hi All,

I've been playing for some time with UnixODBC against a MySQL database in a Linux Mandrake Box. 
Now I wanted to use the same piece of code but against a MS SQL in the network.

Downloaded FreeTds (0.62), Installed, set up a DSN and tryed with tsql (from freetds) and isql (from unixODBC) and in both cases with good results.... Now when I go to my piece of code :

Err = SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&_Env);
Err = SQLSetEnvAttr(_Env, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0);
Err = SQLAllocHandle(SQL_HANDLE_DBC, _Env, &_hdbc);
// some error treatment.....
// Connect to the datasource
Err = SQLConnect(_hdbc, (SQLCHAR *) "pp4", SQL_NTS, (SQLCHAR *) "user", SQL_NTS, (SQLCHAR *) "pass", SQL_NTS);
// some error treatment.....

I receive the following error message from the SQLConnect:
Error: 1044
Msg: [unixODBC][MySQL][ODBC 3.51 Driver]Access denied for user: '@localhost' to database 'Pl02'

The odd part is that the message comes from the MySQL driver apparently.... I couldn't find any other reference to the driver than in the ODBC.ini DNS.... and there it says FREETDS......

Somebody can hint me what I'm doing wrong ? .... I'm sure that should be something VERY silly from my side ... but I've been hanging around quite a long time already and I simply can't see it.

Many Thanks and regards
Alejandro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-dev/attachments/20040717/5f08c395/attachment.html>


More information about the unixODBC-dev mailing list