Plex 2E

  • 1.  JAVA JDBC Connection to DB2 on windows

    Posted Aug 04, 2009 07:00 AM
    Hi  Has anyone had experience on connecting to a windows DB2 installation using JAVA and JDBC?  I started the easy way, first getting the JAVA applet (yes I have it running in a browser succesfully) to talk to a MYSql database. This worked, then the easier option would be to just switch datasources. This didnt.....  DB2ADMIN is the user I connect with. I hoped  I would also get an error if I tried to connect to the database from Excel using the ODBC Datasource, but it worked.  The error I get in the JAVA dispatcher is shown below:
    java.sql.SQLException: [IBM][CLI Driver][DB2/NT] SQL0204N  "DB2ADMIN.STATE_TRACK
    ING_PURCHASE_ORDER" is an undefined name.  SQLSTATE=42704
            at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)
            at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
            at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3149)
            at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedState
    ment.java:216)
            at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery(JdbcOdbcPrepared
    Statement.java:91)
            at ObRun.ObDatabase.ObView.position(Unknown Source)
            at ObRun.ObDatabase.ObDatabaseMgr.positionx(Unknown Source)
            at ObRun.ObDatabase.ObDatabaseMgr.positionx(Unknown Source)
            at log.AAjF_ObFnc.ObSbr_AAjF4(Unknown Source)
            at log.AAjF_ObFnc.ObRun(Unknown Source)
            at ObRun.ObFunction.ObLocalJavaCall.call(Unknown Source)
            at ObRun.ObFunction.ObCallMgr.obCallFunction(Unknown Source)
            at ObRun.ObComms.ObClientConnect.callFunction(Unknown Source)
            at ObRun.ObComms.ObClientConnect.run(Unknown Source)


  • 2.  Re: JAVA JDBC Connection to DB2 on windows

    Posted Aug 04, 2009 07:11 AM
    Hi Gavin,  I think the JDBC-ODBC bridge is best avoided. Here is what the Plex help has to say - not completely up to date on the versions but mayb enough to set you on the right path?   Example 4: DB2 on Windows The following shows the Ob550srv.properties file entries for Java data access for DB2.   Environment.Default.Driver= com.ibm.db2.jcc.DB2Driver Environment.Default.DataSource= jdbc.db2:databasename Environment.Default.User=Userid Environment.Default.Password=Password   Here is DB2 type 4 driver name and URLEnvironment.Default.Driver= com.ibm.db2.jcc.DB2Driver Environment.Default.DataSource= jdbc.db2://095-T202:50000/ntqadb  The following DB2 JDBC driver files will be needed in your client and server classpaths: db2java.zip; db2jcc.jar; db2jcc_license_cu.jar; sqlj.zip.  Note: The Fix Pack Level for DB2 8.1 is 4a.


  • 3.  Re: JAVA JDBC Connection to DB2 on windows

    Posted Aug 05, 2009 02:04 AM
    I have switched to the JDBC and now get this error: If i use the client tool to test a JDBC connection it works, so there is nothing wrong with the comms. I even get it if i give wrong server names, so it is purely to do with the classes I think. I am using DB2 version1.9.4
    C:\objava>"C:\Program Files\Java\jdk1.6.0_07\bin\java" -classpath "c:\objava\sql
    j.zip";"c:\objava\db2jcc_license_cu.jar";"c:\objava\db2java.zip";"c:\objava\db2j
    cc.jar";"C:\objava\obrun.jar";.\;""C:\spar\Log_LOcal\Gen\Bld""; ObRun.ObComms.Ob
    Service Path="C:\objava" 2000 No
    [PLEX0072] AllFusion Plex Dispatcher started.
    java.sql.SQLException: No suitable driver found for jdbc.db2://COD737.spar.net
    :50000/STPO
            at java.sql.DriverManager.getConnection(DriverManager.java:602)
            at java.sql.DriverManager.getConnection(DriverManager.java:185)
            at ObRun.ObDatabase.ObDatabaseConnection.<init>(Unknown Source)
            at ObRun.ObDatabase.ObDatabaseMgr.connect(Unknown Source)
            at ObRun.ObDatabase.ObDatabaseMgr.getDBConnection(Unknown Source)
            at ObRun.ObDatabase.ObDatabaseMgr.getView(Unknown Source)
            at ObRun.ObDatabase.ObDatabaseMgr.positionx(Unknown Source)
            at log.AAjF_ObFnc.ObSbr_AAjF4(Unknown Source)
            at log.AAjF_ObFnc.ObRun(Unknown Source)
            at ObRun.ObFunction.ObLocalJavaCall.call(Unknown Source)
            at ObRun.ObFunction.ObCallMgr.obCallFunction(Unknown Source)
            at ObRun.ObComms.ObClientConnect.callFunction(Unknown Source)
            at ObRun.ObComms.ObClientConnect.run(Unknown Source)
    Message Edited by Gavin on 08-05-2009 12:06 PM [left]