[unixODBC-dev] Problem with libmyodbc and amd64

Olivier Deme odeme at druidsoftware.com
Tue Apr 17 18:21:33 BST 2007


Dear All,

I am experiencing a crash in a database program which uses the mysql 
driver to access a mysql database.
Here is my environment:

OS: Ubuntu 6.06 (Dapper)
Hardware: AMD 64
unixODBC-dev: version 2.2.11-11build1
libmyodbc: version 3.51.11-5ubuntu1

In my program, I use the following CFLAGS:
-g -O2 -march=athlon64

The crash occurs when invoking SQLFetch.
Before SQLFetch, I made a few calls to SQLBindCol.
Here is a snippet of my code:

<START>
     SQLHSTMT    hstmt;
     SQLRETURN   ret;
     SQLCHAR     query [128];

     SQLAllocHandle(SQL_HANDLE_STMT,
                    connectionHandle,
                    &hstmt);
     ACE_OS::snprintf((char*)query,
                      sizeof(query),
                      "SELECT id, name FROM %s WHERE state='ACTIVATED'",
                      tableName);

     ret = SQLExecDirect(hstmt, query, SQL_NTS);
     if (!SQL_SUCCEEDED(ret))
     {
         SQLFreeStmt(hstmt, SQL_DROP);
         return;
     }

     SQLLEN              valuelength;
     SQLUINTEGER         id;
     SQLCHAR             name [20];

     SQLBindCol(hstmt,
                1,
                SQL_C_ULONG,
                &id,
                sizeof(id),
                &valuelength);

     SQLBindCol(hstmt,
                2,
                SQL_C_CHAR,
                name,
                sizeof(name),
                &valuelength);


     // Fetch the data.
     while (SQL_SUCCEEDED(SQLFetch(hstmt)))
	...
<END>

Note that I compiled this program on Ubuntu 6.10 on an intel 32 bit 
platform and it runs fine without any crash.

Note also that if I comment out the SQLBindCol lines, the program 
doesn't crash but SQLFetch doesn't return success.

I was wondering if anybody else has experienced this crash and if you 
would know a fix for it or a workaround.

Thanks for your help!

Olivier



More information about the unixODBC-dev mailing list