• Subject: INSERT fails using JDBC native driver
  • From: "John Caruso" <JohnCaruso@xxxxxxxxx>
  • Date: Fri, 28 Jan 2000 09:40:30 -0800

Can anyone tell me why the following code works when the table is created in
an SQL collection, but not in a normal library?  It fails on the INSERT.  It
appears that the native JDBC driver is using a transaction isolation level
other than the default of NONE.  I've tried specifically setting it to NONE
(see commented out code) only to receive this error:

java.sql.SQLException: [IBM][JDBC Driver][12025] An incorrect transaction
isolation level was specified.

When I execute the SQL statement using interactive SQL or the Client Access
Express SQL scripting utility, I do not encounter any problems.

Is there a PTF to fix this, or am I missing something?

TIA,

John Caruso
----

import java.sql.*;

public class TestJDBC {

    public static void main(java.lang.String[] args) throws Exception {

    Class.forName("com.ibm.db2.jdbc.app.DB2Driver");
    Connection c = DriverManager.getConnection("jdbc:db2:*local");
    // c.setTransactionIsolation(Connection.TRANSACTION_NONE);
    Statement s = c.createStatement();

    s.executeUpdate("CREATE TABLE TEST (ID INTEGER, DESC CHAR(50))");

    s.executeUpdate("INSERT INTO TEST VALUES (1, 'item 1')");

    s.close();
    c.close();

    }
}
----
Here is output when run with normal library:

java.sql.SQLException: TEST in JCARUSO not valid for operation.

com/ibm/db2/jdbc/app/DB2StatementRuntimeImpl.execDirect(ILjava/lang/String;I
I)I+12 (DB2StatementRuntimeImpl.java:90)

com/ibm/db2/jdbc/app/DB2Statement.genericDirectExecutor(Ljava/lang/String;I)
Z+147 (DB2Statement.java:754)

com/ibm/db2/jdbc/app/DB2Statement.executeUpdate(Ljava/lang/String;)I+31
DB2Statement.java:789)
      TestJDBC.main([Ljava/lang/String;)V+28 (TestJDBC.java:13)

+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].