ODBC - Problem found

Jay Miller jaymiller at socket.net
Mon Aug 7 14:54:40 EDT 2000


Ahhh....I've found it.  The ODBC driver isn't set up to read the ODBC.INI
file.  Here is the offending code:

SQLRETURN SQL_API SQLDriverConnect(
    SQLHDBC            hdbc,
    SQLHWND            hwnd,
    SQLCHAR FAR       *szConnStrIn,
    SQLSMALLINT        cbConnStrIn,
    SQLCHAR FAR       *szConnStrOut,
    SQLSMALLINT        cbConnStrOutMax,
    SQLSMALLINT FAR   *pcbConnStrOut,
    SQLUSMALLINT       fDriverCompletion)
{
        /* kludge */
        return SQLConnect(hdbc,"JDBC",NULL,"guest",NULL,"sybase",NULL);
}

SQLRETURN SQL_API SQLConnect(
    SQLHDBC            hdbc,
    SQLCHAR FAR       *szDSN,
    SQLSMALLINT        cbDSN,
    SQLCHAR FAR       *szUID,
    SQLSMALLINT        cbUID,
    SQLCHAR FAR       *szAuthStr,
    SQLSMALLINT        cbAuthStr)
{
struct _hdbc *dbc;

        dbc = (struct _hdbc *) hdbc;

        tds_set_server(dbc->tds_login,szDSN);
        tds_set_user(dbc->tds_login,szUID);
        tds_set_passwd(dbc->tds_login,szAuthStr);
        dbc->tds_socket = (void *) tds_connect(dbc->tds_login);

        return SQL_SUCCESS;
}

I changed the hard coded connect strings to those for my database, then
added the version and port lines from my previous message, now it is
working.

Jay Miller
Socket Internet Services
Columbia, MO, US
http://www.socket.net





More information about the FreeTDS mailing list