[unixODBC-support] SUN's JDBC-ODBC Bridge and unixODBC

Andy Warner andy at klemata.com
Tue Mar 24 14:52:44 GMT 2009


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,

Andy

Nick Gorham wrote:
> Andy Warner wrote:
>
>> Hello,
>>
>> I am attempting to use SUN's JDBC-ODBC bridge to connect to an odbc 
>> data source (CentOS 5.2 and most recent unixODBC). The odbc data 
>> source works fine using isql, the DataManager, and OpenOffice Base. 
>> When I attempt to access the odbc data source through the jdbc bridge 
>> I get a java error that makes me think the jdbc bridge is not 
>> "finding" the unixODBC odbc libraries (a null pointer exception 
>> during the initialization call). I have both unixODBC and the odbc 
>> data source logging, and neither creates their log files. So, I do 
>> not believe they are getting called. Using OpenOffice Base, I was 
>> able to test and verify that the jdbc bridge driver is being loaded.
>>
>> Does anyone have any experience using this bridge with unixODBC? Is 
>> there any special configuration that is needed (such as passing the 
>> odbc driver library path as a connection argument) to link the jdbc 
>> bridge with the unixODBC odbc libs? I realize that sun's jdbc bridge 
>> is very sub-par, but unfortunately I am stuck with it for a demo 
>> project (for now at least).
>>
>> Andy help would be greatly appreciated,
>>
>> Andy Warner
>>
>>  
>>
> Whats the actual error you are getting?
>
> Last tine I checked it was just a case of making sure the JVM could 
> load libodbc.so
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20090324/4bd92a88/attachment.html>


More information about the unixODBC-support mailing list