#1 unixODBC crash IM003 on 64-bit Linux: patch

open
nobody
None
5
2008-11-11
2008-11-11
Guido Leenders
No

Plz see http://forums.oracle.com/forums/thread.jspa?threadID=59110&tstart=5&messageID=2134631#2134631.

Initially, I got identical errors on x64 Linux with Oracle Instantclient
(from ODBC trace file:
...
[ODBC][29227][SQLConnect.c][4160]
Exit:[SQL_SUCCESS]
[ODBC][29227][SQLAllocHandle.c][523]
Entry:
Handle Type = 3
Input Handle = 0x52ba60
[ODBC][29227][SQLAllocHandle.c][653]Error: IM003
[ODBC][29227][SQLAllocHandle.c][523]
Entry:
Handle Type = 3
Input Handle = 0x52ba60
[ODBC][29227][SQLAllocHandle.c][653]Error: IM003
[ODBC][29227][SQLDisconnect.c][204]
...
)

After changing the following two lines in DriverManager/SQLConnect.c:

1814, 1842

OLD: SQLUSMALLINT supported;
NEW: SQLUSMALLINT supported = SQL_TRUE; /* ADDED INITIALIZATION */

And exe/isql.c, line 309:

OLD: if ( SQLPrepare( hStmt, (SQLCHAR*)szSQL, SQL_NTS ) != SQL_SUCCESS )
OLD: if ( SQLPrepare( hStmt, (SQLCHAR*)szSQL, strlen(szSQL) ) != SQL_SUCCESS )

UnixODBC worked perfect!

Could you please include these changes? The first one is just initialization, the second one I can not judge whether it might crash existing code.

Discussion

  • Nick Gorham
    Nick Gorham
    2008-11-21

    Hi,

    What version of the driver manager have you done these changes to, the SQLConnect,c

    Both of them look like a driver bug to me. If needed I can add the changes, but it would (IMHO) be better if oracle fixed the driver, and I don't think the DM is doing anything wrong.

     
  • Guido Leenders
    Guido Leenders
    2008-11-21

    Change was made to unixODBC-2.2.12.

    $Id: SQLConnect.c,v 1.51 2006/06/28 08:08:41 lurcher Exp $

    isql.c has no $Id: $, did:

    # cksum isql.c
    797025721 24331 isql.c

    My 5 cts: Getting Oracle to fix things is quite hard and still keeps the problem that it takes years for a new version to become mainstream. I would recommend changing the C code.

     
  • Nick Gorham
    Nick Gorham
    2008-11-24

    Ok, I will see about adding this in CVS

     
  • Guido Leenders
    Guido Leenders
    2008-11-24

    Thank you, also on behalf of the guys that would be running into this in the feature. Why is x64 so hard, whereas Digital had it already nicely working in 90s?

     
  • Nick Gorham
    Nick Gorham
    2008-11-24

    Ok, I have took a look at this, the suggested fix worries me, as it works because of the particular driver and what it does. But I have tried to tidu up the code in that area, and it should (at least my tests shows it does) fix the problem without needing to resort to driver specifics.

    There is a 2.2.15pre on ftp://ftp.easysoft.com/pub/unixODBC

    Give that a try.

     
  • The -b option also caused a failure on a 64 bit system until I removed line 246 of isql.c:

    char *line;

    It causes the "real" variable line to be out of scope and produces a core dump a few lines below.

     
  • Nick Gorham
    Nick Gorham
    2009-03-10

    Thanks, well found, thats just a copy and paste bug. Will fix in CVS.