[unixODBC-support] SUN's JDBC-ODBC Bridge and unixODBC
Andy Warner
andy at klemata.com
Tue Mar 24 16:46:29 GMT 2009
Nick,
Thanks for your help. strace revealed that the jdbc bridge was looking
for libodbcins.so but I had no /usr/lib/libodbcins.so link, only had
libodbcins.so1 and libodbcins.so.1.0.1. I am not sure why as as far as I
know this was a standard install for CentOS5.2 from the rpm package.
Could this be missing from the install?
I added a link for libodbcins.so and now it will communicate with the
unixODBC driver. However, when the SQLDriverConnect function is called
it fails. The unixODBC driver never calls my odbc driver function. So,
it seems to be failing within unixodbc before it calls my function (The
error message is simply "General Error").
I logged the failed call to SQLDriverConnect and then used Base to make
a direct odbc connection (eliminating the bridge) with the same DNS. The
latter succeeded. I compared the two log entries (which I included
below) and found one thing that seems to stand out. In the failed call
to SQLDriverConnect they do not seem to terminate the PWD attribute with
a semi-colon. In the one that succeeds, it is terminated with a
semi-colon. Do you believe this would cause the unixODBC
SQLDriverConnect function to fail?
*The failed call to SQLDriverConnect:*
[ODBC][11698][SQLDriverConnect.c][678]
Entry:
Connection = 0x997bee0
Window Hdl = (nil)
Str In =
[DSN=rubix-hrast;UID=rxdev;PWD=*******][length
= 37 (SQL_NTS)]
Str Out = 0xbf873a80
Str Out Max = 256
Str Out Ptr = 0xbf873a7e
Completion = 0
UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE
'UCS-2LE'
[ODBC][11698][SQLDriverConnect.c][1258]
Exit:[SQL_ERROR]
[ODBC][11698][SQLError.c][424]
Entry:
Connection = 0x997bee0
SQLState = 0x988f188
Native = 0xbf873aa0
Message Text = 0x997d258
Buffer Length = 300
Text Len Ptr = 0xbf873aa6
[ODBC][11698][SQLError.c][461]
Exit:[SQL_NO_DATA]
*The successful call to SQLDriverConnect:*
[ODBC][11698][SQLDriverConnect.c][678]
Entry:
Connection = 0x98a7c68
Window Hdl = (nil)
Str In =
[DSN=rubix-hrast;UID=rxdev;PWD=*******;][length
= 38]
Str Out = 0xbf8738b8
Str Out Max = 4095
Str Out Ptr = 0xbf8738b6
Completion = 0
UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE
'UCS-2LE'
[ODBC][11698][SQLDriverConnect.c][1487]
Exit:[SQL_SUCCESS]
Nick Gorham wrote:
> Andy Warner wrote:
>
>> The error I am getting from a product called JAMWiki is below. I get
>> the same error when I used OpenOfice Base. The error does not change
>> if the DSN is valid or not. No log files are being created, which
>> leads me to believe that libodbc.so is not being invoked (I have
>> logging/tracing enabled for unixODBC and the driver).
>>
>> java.lang.NullPointerException
>> at
>> sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:436)
>> at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:153)
>> at java.sql.DriverManager.getConnection(DriverManager.java:582)
>> at java.sql.DriverManager.getConnection(DriverManager.java:185)
>> at
>> org.jamwiki.db.DatabaseConnection.getTestConnection(DatabaseConnection.java:323)
>>
>>
>> You mentioned that you thought it was "just a case of making sure the
>> JVM could load libodbc.so" Is there anything that must be done to
>> allow a JVM to access a library such as this? I just assumed that
>> having the library in a well known place (/usr/lib) and having it
>> world readable/executable is enough. I am not very familiar with
>> java, are you aware of anything like an env variable that must be set?
>>
>> Thanks for any help,
>>
> I would check that the jvm and your libodbc are both the same bit
> length (32/64). Also possibly try using strace to see what libs java
> is trying to load, and from where.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20090324/c429a32f/attachment.html>
More information about the unixODBC-support
mailing list