Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 79532 invoked from network); 4 Jan 2010 00:28:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Jan 2010 00:28:10 -0000 Received: (qmail 74498 invoked by uid 500); 4 Jan 2010 00:28:10 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 74452 invoked by uid 500); 4 Jan 2010 00:28:10 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 74444 invoked by uid 99); 4 Jan 2010 00:28:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jan 2010 00:28:09 +0000 X-ASF-Spam-Status: No, hits=-2.2 required=10.0 tests=MIME_QP_LONG_LINE,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [129.215.16.102] (HELO treacle.ucs.ed.ac.uk) (129.215.16.102) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jan 2010 00:27:58 +0000 Received: from lmtp1.ucs.ed.ac.uk (lmtp1.ucs.ed.ac.uk [129.215.149.64]) by treacle.ucs.ed.ac.uk (8.13.8/8.13.4) with ESMTP id o040RcR5009843 for ; Mon, 4 Jan 2010 00:27:38 GMT Received: from smtp.staffmail.ed.ac.uk (mailfe6.ucs.ed.ac.uk [129.215.149.74]) by lmtp1.ucs.ed.ac.uk (8.13.8/8.13.7) with ESMTP id o040Rchs024487 for ; Mon, 4 Jan 2010 00:27:38 GMT Received: from 62-30-148-209.cable.ubr10.sgyl.blueyonder.co.uk (62-30-148-209.cable.ubr10.sgyl.blueyonder.co.uk [62.30.148.209]) by www.staffmail.ed.ac.uk (Horde MIME library) with HTTP; Mon, 04 Jan 2010 00:27:38 +0000 Message-ID: <20100104002738.bzjyn3yjwg4o8sc8@www.staffmail.ed.ac.uk> Date: Mon, 04 Jan 2010 00:27:38 +0000 From: Trevor Carpenter To: "derby-user@db.apache.org" Subject: problem with select statement? MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable X-Edinburgh-Scanned: at treacle.ucs.ed.ac.uk with MIMEDefang 2.60, Sophie, Sophos Anti-Virus, Clam AntiVirus X-Scanned-By: MIMEDefang 2.60 on 129.215.16.102 X-Scanned-By: MIMEDefang 2.52 on 129.215.149.64 X-Virus-Checked: Checked by ClamAV on apache.org Hi when trying to call the next method on a result set generated by a =20 select statement I get the exception: java.sql.SQLException: ResultSet not open. Verify that autocommit is OFF. at =20 org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown =20 Source) at =20 org.apache.derby.client.am.SqlException.getSQLException(Unknown Source) at org.apache.derby.client.am.ResultSet.next(Unknown Source) at jpegrobot.Main.main(Main.java:44) Caused by: org.apache.derby.client.am.SqlException: ResultSet not =20 open. Verify that autocommit is OFF. at =20 org.apache.derby.client.am.ResultSet.checkForClosedResultSet(Unknown =20 Source) at org.apache.derby.client.am.ResultSet.nextX(Unknown Source) ... 2 more Here is the relevant portion of my code: package jpegrobot; import java.io.File; import java.io.IOException; import java.sql.Connection; import java.sql.Date; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.sql.Time; /** * * @author tcarpent */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { // // connect to database try { Connection localConnection =3D null; Statement localStatement; try{ Class.forName("org.apache.derby.jdbc.ClientDriver"); localConnection =3D =20 DriverManager.getConnection("jdbc:derby://localhost:1527/C:/database/mydatab= ase", "*", =20 "*"); System.out.println("Data connection obtained"); } catch (Exception e) { System.err.println("I cannot connect to the database"); System.err.println("Exception: "+e.getMessage()); System.exit(1); } String SQLString =3D"SELECT * FROM WORKFLOW"; localStatement =3D localConnection.createStatement(); ResultSet resultSet =3D localStatement.executeQuery(SQLString); while (resultSet.next()) { <-- exception at call to next() My platform is: ------------------ Java Information ------------------ Java Version: 1.6.0_17 Java Vendor: Sun Microsystems Inc. Java home: C:\Program Files\Java\jre6 Java classpath: C:\Program =20 Files\Sun\JavaDB\bin\../lib/derby.jar;C:\Program =20 Files\Sun\JavaDB\bin\../lib/derbynet.jar;C:\Program Files\Sun\J avaDB\bin\../lib/derbyclient.jar;C:\Program =20 Files\Sun\JavaDB\bin\../lib/derbytools.jar OS name: Windows XP OS architecture: x86 OS version: 5.1 Java user name: tcarpent Java user home: C:\Documents and Settings\tcarpent Java user dir: C:\Program Files\Sun\JavaDB\bin java.specification.name: Java Platform API Specification java.specification.version: 1.6 --------- Derby Information -------- JRE - JDBC: Java SE 6 - JDBC 4.0 [C:\Program Files\Sun\JavaDB\lib\derby.jar] 10.4.2.1 - (706043) [C:\Program Files\Sun\JavaDB\lib\derbytools.jar] 10.4.2.1 - (706043) [C:\Program Files\Sun\JavaDB\lib\derbynet.jar] 10.4.2.1 - (706043) [C:\Program Files\Sun\JavaDB\lib\derbyclient.jar] 10.4.2.1 - (706043) ------------------------------------------------------ is the result set closed after committing the select statment (why)? I =20 have tried specifying cursor hold etc? Thanks Trevor --=20 The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.