[unixODBC-dev] Connection to MS-SQL

Nick Gorham nick at easysoft.com
Sat Jul 17 14:29:09 BST 2004


Alejandro Rotolo wrote:

> 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' <mailto:%27 at localhost%27> to database 'Pl02'


Check the driver line in the pp4 odbc.ini entry, it may still be 
pointing to the MySQL driver.

-- 
Nick



More information about the unixODBC-dev mailing list