From derby-user-return-6130-apmail-db-derby-user-archive=db.apache.org@db.apache.org Fri Feb 09 18:46:25 2007 Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 53674 invoked from network); 9 Feb 2007 18:46:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Feb 2007 18:46:24 -0000 Received: (qmail 85266 invoked by uid 500); 9 Feb 2007 18:46:30 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 85238 invoked by uid 500); 9 Feb 2007 18:46:30 -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 85227 invoked by uid 99); 9 Feb 2007 18:46:30 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Feb 2007 10:46:30 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of msatoor@gmail.com designates 66.249.92.171 as permitted sender) Received: from [66.249.92.171] (HELO ug-out-1314.google.com) (66.249.92.171) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Feb 2007 10:46:19 -0800 Received: by ug-out-1314.google.com with SMTP id o2so863251uge for ; Fri, 09 Feb 2007 10:45:53 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=JX4oODcoczvynhAh95yBPURO4S+v4mbYS7y/YM764n+UXI3Wjul7Hn3aVdb/sBZezSt0YA5/UjMise55mUTfoEmm/BI/JljxYZUE3xOo8obFOWkusA8JtsC/YAO2JD15u6kpBK+qqHQkM1Qos3sR11wBKoRU6yRR4LWb/Gw1DmY= Received: by 10.78.193.19 with SMTP id q19mr2300489huf.1171046752015; Fri, 09 Feb 2007 10:45:52 -0800 (PST) Received: by 10.78.175.4 with HTTP; Fri, 9 Feb 2007 10:45:51 -0800 (PST) Message-ID: Date: Fri, 9 Feb 2007 10:45:51 -0800 From: "Mamta Satoor" To: "Derby Discussion" Subject: Re: Problem with create table in Derby 10.2.2.0 In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_25755_5304472.1171046751909" References: X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_25755_5304472.1171046751909 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Leo, You need to use BIGINT rather than long for KEY_ID column. Mamta On 2/9/07, Leo Alberto wrote: > > Hy > I'm try to using Derby 10.2.2.0 in > embedded mode with the integrated plug-in environment in Eclipse 3.2.0. > Environment jre 1.6.0 > I would create a table with this code : > > *public* *boolean* tableCreation(Connection currentConn, String Table) > > *throws* DatabaseDriverException { > > *boolean* doCreateTable = *true*; > > Statement stmt = *null*; > > String createString = "create table " + > > Table + > > "(SAMPLE_ID int not null generate always as increment, " + > > "KEY_ID long, " + > > "KEY_INST_COUNT int, " + > > "DATAOBJ blob (102400), " + > > "unique(KEY_ID))"; > > > > *try* { > > > > currentConn.setAutoCommit(*false*); > > stmt = currentConn.createStatement(); > > DatabaseMetaData md = currentConn.getMetaData(); > > ResultSet rs = md.getTables(*null*, *null*, "%", *null > *); > > *while* (rs.next()) { > > System.*out*.println("Elenco tabelle nel db " + rs.getString(3)); > > *if* (rs.getString(3).equals(tabella)) { > > doCreateTable = *false*; > > *break*; > > } > > } > > *if* (doCreateTable) { > > // execute > > stmt.execute(createString); // *I'm arriving > here ang got the error* > > doCreateTable = *true*; > > } > > currentConn.commit(); > > stmt.close(); > > > > } *catch* (SQLException e) { > > *throw* *new* DatabaseDriverException("Error create > table", e); > > } > > *return* doCreateTable; > > }/* End tableCreation */ > the error is: > > Syntax error: Encountered "," at line 1, column 88. > > at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown > Source) > > at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown > Source) > > at > org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown > Source) > > at > org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown > Source) > > at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown > Source) > > at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown > Source) > > at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown > Source)Error create table > > > > at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown > Source) > > at dds.dbdrivers.DerbyDriver.tableCreation(*DerbyDriver.java:257*) > > at provaDB.main(*provaDB.java:39*) > > Caused by: *java.sql.SQLException*: Syntax error: Encountered "," at line > 1, column 88. > > at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown > Source) > > at > org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown > Source) > > ... 10 more > > from errorlog.txt generated: > > ---------------------------------------------------------------- > > 2007-02-09 17:31:01.452 GMT: > > Booting Derby version The Apache Software Foundation - Apache Derby - > 10.2.2.0 - (485682): instance c013800d-0110-a78e-d8b1-ffffa2db3c51 > > on database directory C:\DdsAppDb\DbDOMAIN_(7) > > > > Database Class Loader started - derby.database.classpath='' > > 2007-02-09 17:31:10.786 GMT Thread[main,5,main] (XID = 122), (SESSIONID = > 0), (DATABASE = DbDOMAIN_(7)), (DRDAID = null), Cleanup action starting > > 2007-02-09 17:31:10.786 GMT Thread[main,5,main] (XID = 122), (SESSIONID = > 0), (DATABASE = DbDOMAIN_(7)), (DRDAID = null), Failed Statement is: > > > > > > > 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 > > create table POSITION (SAMPLE_ID int not null generated always as > identity, KEY_ID long, KEY_INST_COUNT int, DATAOBJ blob (102400), > unique(KEY_ID)) > > ERROR 42X01: Syntax error: Encountered "," at line 1, column 88. > > at org.apache.derby.iapi.error.StandardException.newException(Unknown > Source) > > at org.apache.derby.impl.sql.compile.ParserImpl.parseStatement(Unknown > Source) > > at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown > Source) > > at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown > Source) > > at > org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown > Source) > > at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown > Source) > > at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown > Source) > > at dds.dbdrivers.DerbyDriver.tableCreation(DerbyDriver.java:257) > > at provaDB.main(provaDB.java:39) > > Cleanup action completed > > > > I would be very glad if someone can help me understand wath is wrong! > > thanks in advance > > Alberto Leo > > ------=_Part_25755_5304472.1171046751909 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
Leo,
 
You need to use BIGINT rather than long for KEY_ID column.
 
Mamta

 
On 2/9/07, Leo Alberto <Alberto.Leo@ssi.it> wrote:
Hy
I'm try to using Derby 10.2.2.0 in embedded mode with the integrated plug-in environment in Eclipse 3.2.0. Environment jre 1.6.0
I would create a table with this code :

public boolean tableCreation(Connection currentConn, String Table)

                    throws DatabaseDriverException {

boolean doCreateTable = true;

             Statement stmt = null;

             String createString = "create table " +

Table +

"(SAMPLE_ID int not null generate always as increment, " +

"KEY_ID long, " +

"KEY_INST_COUNT int, " +

"DATAOBJ blob (102400), " +

             "unique(KEY_ID))";

            

             try {

 

                    currentConn.setAutoCommit (false);

                    stmt = currentConn.createStatement();

                    DatabaseMetaData md = currentConn.getMetaData();

                    ResultSet rs = md.getTables(null, null, "%", null);

                    while (rs.next()) {

System.out .println("Elenco tabelle nel db " + rs.getString(3));

                           if (rs.getString(3).equals(tabella)) {

                                  doCreateTable = false;

                                  break;

                           }

                    }

                    if (doCreateTable) {

                           // execute

                           stmt. execute(createString); // I'm arriving here ang got the error

                           doCreateTable = true;

                    }

                    currentConn.commit();

                    stmt.close();

 

             } catch (SQLException e) {

                    throw new DatabaseDriverException("Error create table", e);

             }

             return doCreateTable;

       }/* End tableCreation */

the error is:

Syntax error: Encountered "," at line 1, column 88.

       at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)

       at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)

       at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)

       at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)

       at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)

       at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)

       at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)Error create table

 

       at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)

       at dds.dbdrivers.DerbyDriver.tableCreation( DerbyDriver.java:257)

       at provaDB.main(provaDB.java:39 )

Caused by: java.sql.SQLException : Syntax error: Encountered "," at line 1, column 88.

       at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)

       at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)

       ... 10 more

from errorlog.txt generated:

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

2007-02-09 17:31:01.452 GMT:

 Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.2.0 - (485682): instance c013800d-0110-a78e-d8b1-ffffa2db3c51

on database directory C:\DdsAppDb\DbDOMAIN_(7) 

 

Database Class Loader started - derby.database.classpath=''

2007-02-09 17:31:10.786 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = DbDOMAIN_(7)), (DRDAID = null), Cleanup action starting

2007-02-09 17:31:10.786 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), (DATABASE = DbDOMAIN_(7)), (DRDAID = null), Failed Statement is:

 

<my add>

1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678

create table POSITION (SAMPLE_ID int not null generated always as identity, KEY_ID long, KEY_INST_COUNT int, DATAOBJ blob (102400), unique(KEY_ID))

ERROR 42X01: Syntax error: Encountered "," at line 1, column 88.

       at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)

       at org.apache.derby.impl.sql.compile.ParserImpl.parseStatement(Unknown Source)

       at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)

       at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)

       at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)

       at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)

       at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)

       at dds.dbdrivers.DerbyDriver.tableCreation(DerbyDriver.java:257)

       at provaDB.main(provaDB.java:39)

Cleanup action completed

 

I would be very glad if someone can help me understand wath is wrong!

thanks in advance

Alberto Leo

 

------=_Part_25755_5304472.1171046751909--