problem with SQL connect on Solaris with MySQL

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

problem with SQL connect on Solaris with MySQL

Andy Howell

I'm having problems connecting to a MySQL server. My app is running on
Solaris, and the server on a linux box. When it tries to connect, I get
back an error:

[unixODBC][MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on
'furball' (2) (2003)

I can use isql to connect to the same server with the same credentials
just fine. That points to my code being broken. However, the same code
compiled and run on a linux box works fine. All machines are using
unixODBC 2.2.11.

I watched the packets with ethereal, and I saw that right after the
MySQL server sends a "Server Greeting Protocol" message, the client app
disconnects. Doing the same with isql shows the username and password
being sent to the server.

I tried to trace through the unixODBC code, but can't trace through the
SQLCONNECT macro ( 3819 in DriverMangerSQLconnect.c ). From what I
gather, its at that point that it calls the driver code.

I tried to turn on tracing in the odbc.ini file, but nothing gets
written. Is there some magic I can invoke to get the mysql driver to
give more information? I don't know what the "(2) (2003)" at the end of
the error message mean.

Thanks,

        Andy

_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mail.easysoft.com/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: problem with SQL connect on Solaris with MySQL

Eric Sharkey
> I tried to turn on tracing in the odbc.ini file, but nothing gets
> written.

Driver manager tracing is enabled in odbcinst.ini, not odbc.ini.
Just add:

[ODBC]
Trace           = Yes

If you add that to odbc.ini instead of odbcinst.ini, it will be ignored.

Eric
_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mail.easysoft.com/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: problem with SQL connect on Solaris with MySQL

Andy Howell
Eric Sharkey wrote:
> Driver manager tracing is enabled in odbcinst.ini, not odbc.ini.
> Just add:
>
> [ODBC]
> Trace           = Yes
>
> If you add that to odbc.ini instead of odbcinst.ini, it will be ignored.
>

Found the problem. In my code I had:

SQLSetConnectAttr( sqlDbConnHdl, SQL_LOGIN_TIMEOUT,
        (SQLPOINTER *)5, 0);

For some reason this does not work on solaris. When I commented out that
line, it worked fine. I tried increasing the timeout to 30 seconds, but
that didn't make any difference. In the log file, I could see that the
value was being set. Its still a mystery to me why this causes a problem
on solaris, but not linux. Maybe a problem with the MySQL driver?

I used http://www.unixodbc.org/doc/ProgrammerManual/Tutorial/conne.html
as the basis for my code.

Thanks,

        Andy
_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mail.easysoft.com/mailman/listinfo/unixodbc-support