Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 84272 invoked from network); 26 Nov 2010 14:39:37 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 Nov 2010 14:39:37 -0000 Received: (qmail 56535 invoked by uid 500); 26 Nov 2010 14:39:37 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 56508 invoked by uid 500); 26 Nov 2010 14:39:36 -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 56496 invoked by uid 99); 26 Nov 2010 14:39:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Nov 2010 14:39:36 +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.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Nov 2010 14:39:35 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id oAQEdEPr017467 for ; Fri, 26 Nov 2010 14:39:15 GMT Message-ID: <17170489.324121290782354909.JavaMail.jira@thor> Date: Fri, 26 Nov 2010 09:39:14 -0500 (EST) From: "Knut Anders Hatlen (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Resolved: (DERBY-4921) Statement.executeUpdate(String sql, String[] columnNames) throws ERROR X0X0F.S exception with EmbeddedDriver In-Reply-To: <24718480.316831290715753738.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DERBY-4921?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:all-tabpanel ] Knut Anders Hatlen resolved DERBY-4921. --------------------------------------- Resolution: Not A Problem Bug behavior facts: (was: [Deviation from standard]) > Statement.executeUpdate(String sql, String[] columnNames) throws ERROR = X0X0F.S exception with EmbeddedDriver > -------------------------------------------------------------------------= ------------------------------------- > > Key: DERBY-4921 > URL: https://issues.apache.org/jira/browse/DERBY-4921 > Project: Derby > Issue Type: Bug > Components: JDBC > Affects Versions: 10.6.2.1 > Reporter: Jarek Przyg=C3=B3dzki > > Statement.executeUpdate(insertSql, int[] columnIndexes) and Statement/exe= cuteUpdate(insertSql,Statement.RETURN_GENERATED_KEYS) does work, Statement= .executeUpdate(String sql, String[] columnNames) doesn't. > Test program > import java.sql.Connection; > import java.sql.DriverManager; > import java.sql.ResultSet; > import java.sql.Statement; > public class GetGeneratedKeysTest { > =09static String createTableSql =3D "CREATE TABLE tbl (id integer primary= key generated always as identity, name varchar(200))"; > =09static String insertSql =3D "INSERT INTO tbl(name) values('value')"; > =09static String driver =3D "org.apache.derby.jdbc.EmbeddedDriver"; > =09static String[] idColName =3D { "id" }; > =09public static void main(String[] args) throws Exception { > =09=09Class.forName(driver); > =09=09Connection conn =3D DriverManager > =09=09=09=09.getConnection("jdbc:derby:testDb;create=3Dtrue"); > =09=09conn.setAutoCommit(false); > =09=09Statement stmt =3D conn.createStatement(); > =09=09ResultSet rs; > =09=09stmt.executeUpdate(createTableSql); > =09=09stmt.executeUpdate(insertSql, idColName); > =09=09rs =3D stmt.getGeneratedKeys(); > =09=09if (rs.next()) { > =09=09=09int id =3D rs.getInt(1); > =09=09} > =09=09conn.commit(); > =09} > } > Result > Exception in thread "main" java.sql.SQLException: Table 'TBL' does not ha= ve an auto-generated column named 'id'. > =09at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQ= LExceptionFactory40.java:95) > =09at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:25= 6) > =09at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLExcepti= on(TransactionResourceImpl.java:391) > =09at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(= TransactionResourceImpl.java:346) > =09at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedCon= nection.java:2269) > =09at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Connecti= onChild.java:81) > =09at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedSta= tement.java:1321) > =09at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.ja= va:625) > =09at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(EmbedStatem= ent.java:246) > =09at GetGeneratedKeysTest.main(GetGeneratedKeysTest.java:23) > Caused by: java.sql.SQLException: Table 'TBL' does not have an auto-gener= ated column named 'id'. > =09at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLE= xceptionFactory.java:45) > =09at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTranspo= rtAcrossDRDA(SQLExceptionFactory40.java:119) > =09at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQ= LExceptionFactory40.java:70) > =09... 9 more > Caused by: ERROR X0X0F: Table 'TBL' does not have an auto-generated colum= n named 'id'. > =09at org.apache.derby.iapi.error.StandardException.newException(Standard= Exception.java:303) > =09at org.apache.derby.impl.sql.execute.InsertResultSet.verifyAutoGenerat= edColumnsNames(InsertResultSet.java:689) > =09at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResult= Set.java:419) > =09at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Gene= ricPreparedStatement.java:436) > =09at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericP= reparedStatement.java:317) > =09at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedSta= tement.java:1232) > =09... 3 more --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.