Topic
2 replies Latest Post - ‏2007-10-17T19:34:18Z by SystemAdmin
SystemAdmin
SystemAdmin
1525 Posts
ACCEPTED ANSWER

Pinned topic Problem with JDBC-ODBC bridge driver to access Derby on Windows

‏2007-01-06T23:27:55Z |
Problem with JDBC-ODBC bridge driver to access Derby on Windows

I installed DB2 Run-Time Client Lite Version 8.2.5 onto an XP box. And did the follows to configure a System DSN for Windows ODBC:

(1) ij> connect 'jdbc:derby://localhost:1527/SAMPLE4;create=true;user=app;password=app;';

(2) C:\Program Files\IBM\SQLLIB\BIN > db2 catalog db SAMPLE4 at node DERBYNET authentication server

(3) C:\Program Files\IBM\SQLLIB\BIN > db2 catalog system odbc data source SAMPLE4

However, I failed to run 'java DBConn_Type1 SAMPLE4 app app' at command line where DBConn_Type1 program is from article Connectivity cheat sheet for Application Developers (Part 4) (http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0401chong).

Error I got is:

*** Error ***
java.sql.SQLException: MicrosoftODBC Driver Manager Driver's SQLAllocHandle on SQL_HANDLE_ENV failed
java.sql.SQLException: MicrosoftODBC Driver Manager Driver's SQLAllocHandle on SQL_HANDLE_ENV failed
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6998)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7155)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3106)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:355)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:209)
at java.sql.DriverManager.getConnection(DriverManager.java:559)
at java.sql.DriverManager.getConnection(DriverManager.java:189)
at DBConn_Type1.main(DBConn_Type1.java:26)

Could anyone shed some light on what was missing?

Thanks much.
Updated on 2007-10-17T19:34:18Z at 2007-10-17T19:34:18Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    1525 Posts
    ACCEPTED ANSWER

    Re: Problem with JDBC-ODBC bridge driver to access Derby on Windows

    ‏2007-01-07T01:43:55Z  in response to SystemAdmin
    I figured it out. After these two jar files (C:\Program Files\IBM\SQLLIB\java\db2jcc.jar and C:\Program Files\IBM\SQLLIB\java\db2jcc_javax.jar), both came from DB2 Run-Time Client Lite, were included in classpath, test passes.
    • SystemAdmin
      SystemAdmin
      1525 Posts
      ACCEPTED ANSWER

      Re: Problem with JDBC-ODBC bridge driver to access Derby on Windows

      ‏2007-10-17T19:34:18Z  in response to SystemAdmin
      Don't work if you are trying to get ODBC copnnection to Apache Derby using PHP.
      I'm using a WAMP Server ...From ODBC tools, the conection is fine ... from PHP get the error
      SQL_HANDLE_ENV, SQL state IM004 in SQLConnect

      Anyone help ?