× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: INSERT fails using JDBC native driver
  • From: cujo@xxxxxxxxxx
  • Date: Fri, 28 Jan 2000 12:46:07 -0600

First, Native JDBC used to not allow the user to set the level to none,
because the JDBC documentation says that none is a special value to
represent the fact that transactions are not supported.  In a v4r4 PTF
along the way we changed to allow this to work anyway, because our customer
base understands the concept of TX level none in a different light.  Please
note that I do believe that the Toolbox JDBC driver still will throw an
exception on this line (but don't hold me to that).

-------------------

Now for the main issue.  I don't believe you specified a release so I just
tested it on my development box to see what would happen.  Everything
seemed to work just fine.  What did you do that is different than these
steps?

1) I created the library to use from the green screen:

crtlib cujotest
Library CUJOTEST created.

2) I modified your program just a little.  I had a TestJDBC program
already, and I qualified the TEST table references:

import java.sql.*;

public class TestJDBC10 {

    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 CUJOTEST.TEST (ID INTEGER, DESC
CHAR(50))");

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

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

    }
}

3) I ran the program from the green screen:

java TestJDBC10

4) Through interactive SQL I typed this:

select * from cujotest.test

5) This is the results:

           ID   DESC
            1   item 1
********  End of data  ********



Regards,

Richard D. Dettinger
AS/400 Java Data Access Team

"TRUE! nervous, very, very dreadfully nervous I had been and am; but why
WILL you say that I am mad?
The disease had sharpened my senses, not destroyed, not dulled them. "

- Edgar Allan Poe
"The Tell-Tale Heart"




"John Caruso" <JohnCaruso@email.com> on 01/28/2000 11:40:30 AM

Please respond to JAVA400-L@midrange.com

To:   JAVA400-L@midrange.com
cc:
Subject:  INSERT fails using JDBC native driver




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 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
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.