Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 3022 invoked from network); 12 May 2009 07:01:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 May 2009 07:01:09 -0000 Received: (qmail 27984 invoked by uid 500); 12 May 2009 07:01:09 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 27946 invoked by uid 500); 12 May 2009 07:01:09 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 27938 invoked by uid 99); 12 May 2009 07:01:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 May 2009 07:01:09 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 May 2009 07:01:07 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id AC048234C004 for ; Tue, 12 May 2009 00:00:46 -0700 (PDT) Message-ID: <762405804.1242111645553.JavaMail.jira@brutus> Date: Tue, 12 May 2009 00:00:45 -0700 (PDT) From: "Simon Meng (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Created: (DERBY-4224) Got SQLException MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org Got SQLException ---------------- Key: DERBY-4224 URL: https://issues.apache.org/jira/browse/DERBY-4224 Project: Derby Issue Type: Bug Components: JDBC Affects Versions: 10.4.2.0 Reporter: Simon Meng Got below error message when running a JDBC prolgram with derby. I use Apache Derby Network Server - 10.4.2.0 - (689064). The same program works fine with another version Apache Derby Network Server - 10.2.2.0 - (485682). It looks like there is a regression between the two versions. Exception in thread "main" java.sql.SQLException: You cannot invoke other java.sql.Clob/java.sql.Blob methods after calling the free() method or after the Blob/Clob's transaction has been committed or rolled back. at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source) at org.apache.derby.client.am.Lob.checkValidity(Unknown Source) at org.apache.derby.client.am.Clob.length(Unknown Source) at org.apache.derby.client.net.NetStatementRequest.computeProtocolTypesAndLengths(Unknown Source) at org.apache.derby.client.net.NetStatementRequest.buildSQLDTAcommandData(Unknown Source) at org.apache.derby.client.net.NetStatementRequest.writeExecute(Unknown Source) at org.apache.derby.client.net.NetPreparedStatement.writeExecute_(Unknown Source) at org.apache.derby.client.am.PreparedStatement.writeExecute(Unknown Source) at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source) at org.apache.derby.client.am.PreparedStatement.executeX(Unknown Source) at org.apache.derby.client.am.PreparedStatement.execute(Unknown Source) at DerbyTest.test(DerbyTest.java:36) at DerbyTest.main(DerbyTest.java:12) Caused by: org.apache.derby.client.am.SqlException: You cannot invoke other java.sql.Clob/java.sql.Blob methods after calling the free() method or after the Blob/Clob's transaction has been committed or rolled back. ... 12 more Below is the test program I used. import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Statement; public class DerbyTest { public static void main(String[] args) throws SQLException, IOException { new DerbyTest().test(); } private void test() throws SQLException, IOException { Connection conn = null; try { conn = getConnection(); Statement stmt = conn.createStatement(); dropTable("test1"); dropTable("test2"); String createStr1 = "CREATE TABLE test1 (col0 VARCHAR(8000))"; String createStr2 = "CREATE TABLE test2 (col0 VARCHAR(8000))"; stmt.executeUpdate(createStr1); stmt.executeUpdate(createStr2); stmt.close(); PreparedStatement pstmt1 = conn.prepareStatement("INSERT INTO test1 VALUES (?)"); PreparedStatement pstmt2 = conn.prepareStatement("INSERT INTO test1 VALUES (?)"); InputStream in1 = new ByteArrayInputStream("abcdefghijklmnopqrstuvwxyz0123456789".getBytes()); InputStream in2 = new ByteArrayInputStream("9876543210ZYXWVUTSRQPONMLKJIHGFEDCBA".getBytes()); pstmt1.setAsciiStream(1, in1, in1.available()); pstmt2.setAsciiStream(1, in2, in2.available()); pstmt1.execute(); pstmt2.execute(); pstmt1.close(); pstmt2.close(); System.out.println("Successful"); } finally { if (conn != null) conn.close(); } } private Connection getDriverConnection() throws SQLException { String connectionURL = "jdbc:derby://localhost:1527/testdb;user=app;password=derby;create=true"; return DriverManager.getConnection(connectionURL); } private Connection getConnection() throws SQLException { return getDriverConnection(); } public void dropTable(String tableName) throws SQLException { Connection conn = getConnection(); Statement stmt = conn.createStatement(); try { stmt.executeUpdate("DROP TABLE " + tableName); } catch (SQLException sqle) { System.out.println("Error occured when drop table: " + sqle.getMessage()); } finally { if (stmt != null) { stmt.close(); } if (conn != null) { conn.close(); } } } } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.