One Star

JavaDB problems

I build a very small test case with a mysql table in Input and a JavaDB table four output.
I just insert have one field (integer) in my javadb output table.
I have a silly error message about a syntax error:
Exception in component tJavaDBOutput_1
java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, column 39.
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)
at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
at test.injection_0_1.injection.tMysqlInput_1Process(injection.java:1067)
at test.injection_0_1.injection.runJobInTOS(injection.java:1909)
at test.injection_0_1.injection.main(injection.java:1826)
Caused by: java.sql.SQLException: Syntax error: Encountered "(" at line 1, column 39.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
... 11 more
Caused by: ERROR 42X01: Syntax error: Encountered "(" at line 1, column 39.
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)
... 5 more

what's wrong with the generated code ?
7 REPLIES
One Star

Re: JavaDB problems

may be these linea cause the error ?
stmtCreate_tJavaDBOutput_1
.execute("CREATE TABLE \""
+ tableName_tJavaDBOutput_1
+ "\"(\"ID\" INT(10,0) not null ,primary key(\"ID\"))");
Seventeen Stars

Re: JavaDB problems

hi
i think you're right Smiley Happy

("CREATE TABLE \""
+ tableName_tJavaDBOutput_1
+ "\"(\"ID\" INT(10,0) not null ,primary key(\"ID\"))")
...
You've a "duplicate double quote after 'CREATE TABLE' ... delete one !
++
One Star

Re: JavaDB problems

but it is a code generated by Talend !
to be sure, I have destoryed all the " to produce this code
stmtCreate_tJavaDBOutput_1
.execute("CREATE TABLE
+ tableName_tJavaDBOutput_1
+ " (ID INT(10,0) not null ,primary key(ID))");
but always this stack error:
connecting to socket on port 3684
connected
Exception in component tJavaDBOutput_1
java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, column 39.
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)
at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
at test.injection_0_1.injection.tMysqlInput_1Process(injection.java:1077)
at test.injection_0_1.injection.runJobInTOS(injection.java:1971)
at test.injection_0_1.injection.main(injection.java:1881)
Caused by: java.sql.SQLException: Syntax error: Encountered "(" at line 1, column 39.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
... 11 more
Caused by: ERROR 42X01: Syntax error: Encountered "(" at line 1, column 39.
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) disconnected
... 5 more
it seems that the syntax generated by Talend is not correct: create table foo (ID INT(10,0) not null ,primary key(ID))
One Star

Re: JavaDB problems

all is correct when creating the output by typing tne name and types.
If it is done with drag and drop, code is not correct :-(
Seventeen Stars

Re: JavaDB problems

seems to be a bug so ....
++
One Star

Re: JavaDB problems

yes, it is the drag and drop of an integer field to a JavaDB output which is the origin of the bug
One Star

Re: JavaDB problems

same issue with varchar(65536)