[jira] [Commented] (DERBY-6880) Update failing with java.sql.SQLDataException

2016-04-28 Thread Simon Zee (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15262027#comment-15262027
 ] 

Simon Zee commented on DERBY-6880:
--

Bryan, thanks for your persistence and diligence on this issue!

I think you've made the right call. While there was clearly an intention behind 
the code changes that were made, the regression caused seems worse than 
whatever subtle feature of the JDBC APIs they were intended to implement.

> Update failing with java.sql.SQLDataException 
> --
>
> Key: DERBY-6880
> URL: https://issues.apache.org/jira/browse/DERBY-6880
> Project: Derby
>  Issue Type: Bug
>Affects Versions: 10.12.1.1
>Reporter: Simon Zee
>Assignee: Bryan Pendleton
> Fix For: 10.13.0.0
>
> Attachments: repro.diff, standalone.java, undo6742.diff, 
> undoMoreTests.diff
>
>
> When updating a single column in a table using executeUpdate() via Vert.x I 
> am receiving the following exception:
> java.sql.SQLDataException: Invalid character string format for type long.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:84)
>   at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:233)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:424)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
>   at 
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2405)
>   at 
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:88)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1432)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1709)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(EmbedPreparedStatement.java:320)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:309)
>   at 
> com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:410)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:50)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:34)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:48)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:33)
>   at 
> io.vertx.core.impl.ContextImpl.lambda$executeBlocking$15(ContextImpl.java:296)
>   at 
> io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor.lambda$new$261(OrderedExecutorFactory.java:91)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>   at java.lang.Thread.run(Thread.java:745)
> Caused by: ERROR 22018: Invalid character string format for type long.
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:290)
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:285)
>   at org.apache.derby.iapi.types.SQLChar.getLong(SQLChar.java:447)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRows(UpdateResultSet.java:534)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.open(UpdateResultSet.java:272)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:473)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:352)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1340)
>   ... 13 more
> Further details and discussion can be found here:
> https://mail-archives.apache.org/mod_mbox/db-derby-user/201603.mbox/%3CCAHbUnCXkHMKE1u9R3D-z9Njp8goAV7%2B0vPOmgafH8DCqG8mSpQ%40mail.gmail.com%3E
> Notably, I have tried executing the same update via other means (for example, 
> manually via SquirrelSQL, and via the ORMLite framework) and the update 
> succeeds. This may be due to the exact JDBC APIs they are using (for example, 
> SquirrelSQL is not using a prepared statement, and ORMLite updates all the 
> columns when it updates a table rather than just some of them).
> I have created a complete but minimal example that illustrates the problem in 
> the following GitHub project:
> https://github.com/ssadedin/DerbyDebug
> My derby / system information is as follows:
> $ java -cp 'lib/*' org.apache.derby.tools.sysinfo
> -- Java Information --
> Java Version:

[jira] [Commented] (DERBY-6880) Update failing with java.sql.SQLDataException

2016-04-27 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15261437#comment-15261437
 ] 

ASF subversion and git services commented on DERBY-6880:


Commit 1741380 from [~bryanpendleton] in branch 'code/trunk'
[ https://svn.apache.org/r1741380 ]

DERBY-6880: Update failing with java.sql.SQLDataException

This change reverts part of the changes made by revision 1628596 for DERBY-6742.

Specifically, the section of code added to UpdateResultSet.collectAffectedRows
is removed. That code caused problems with certain SQL UPDATE statements
which were compiled with Statement.RETURN_GENERATED_KEYS. The new test cases
added by this change include several examples of such SQL statements.

The JDBC documentation for the intended behavior of UPDATE statements with the
RETURN_GENERATED_KEYS option is unclear; the intended behavior is much
clearer with INSERT statements. Given that I don't understand the intended
behavior, it seems safer to me to return Derby to the previous state for
UPDATE statements; namely, that no attempt is made to compute the set of
generated keys for an UPDATE statement.

> Update failing with java.sql.SQLDataException 
> --
>
> Key: DERBY-6880
> URL: https://issues.apache.org/jira/browse/DERBY-6880
> Project: Derby
>  Issue Type: Bug
>Affects Versions: 10.12.1.1
>Reporter: Simon Zee
> Attachments: repro.diff, standalone.java, undo6742.diff, 
> undoMoreTests.diff
>
>
> When updating a single column in a table using executeUpdate() via Vert.x I 
> am receiving the following exception:
> java.sql.SQLDataException: Invalid character string format for type long.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:84)
>   at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:233)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:424)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
>   at 
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2405)
>   at 
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:88)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1432)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1709)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(EmbedPreparedStatement.java:320)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:309)
>   at 
> com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:410)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:50)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:34)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:48)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:33)
>   at 
> io.vertx.core.impl.ContextImpl.lambda$executeBlocking$15(ContextImpl.java:296)
>   at 
> io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor.lambda$new$261(OrderedExecutorFactory.java:91)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>   at java.lang.Thread.run(Thread.java:745)
> Caused by: ERROR 22018: Invalid character string format for type long.
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:290)
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:285)
>   at org.apache.derby.iapi.types.SQLChar.getLong(SQLChar.java:447)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRows(UpdateResultSet.java:534)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.open(UpdateResultSet.java:272)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:473)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:352)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1340)
>   ... 13 more
> Further details and discussion can be found here:
> https://mail-archives.apache.org/mod_mbox/db-derby-user/201603.mbox/%3CCAHbUnCXkHMKE1u9R3D-z9Njp8goAV7%2B0vPOmgafH8DCqG8mSpQ%40mail.gmail.com%3E
> Notably, I have tried executing the same update via other means (for example, 
> 

[jira] [Commented] (DERBY-6880) Update failing with java.sql.SQLDataException

2016-04-09 Thread Bryan Pendleton (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15233679#comment-15233679
 ] 

Bryan Pendleton commented on DERBY-6880:


Soren, does DB2 allow
{quote}
PreparedStatement ustmt = conn.prepareStatement(
"update pipeline_command set status = 'WAIT RESULT'" +
" where id = ?", new String[] {"STATUS"});
{quote}

> Update failing with java.sql.SQLDataException 
> --
>
> Key: DERBY-6880
> URL: https://issues.apache.org/jira/browse/DERBY-6880
> Project: Derby
>  Issue Type: Bug
>Affects Versions: 10.12.1.1
>Reporter: Simon Zee
> Attachments: repro.diff, standalone.java, undo6742.diff
>
>
> When updating a single column in a table using executeUpdate() via Vert.x I 
> am receiving the following exception:
> java.sql.SQLDataException: Invalid character string format for type long.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:84)
>   at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:233)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:424)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
>   at 
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2405)
>   at 
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:88)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1432)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1709)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(EmbedPreparedStatement.java:320)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:309)
>   at 
> com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:410)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:50)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:34)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:48)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:33)
>   at 
> io.vertx.core.impl.ContextImpl.lambda$executeBlocking$15(ContextImpl.java:296)
>   at 
> io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor.lambda$new$261(OrderedExecutorFactory.java:91)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>   at java.lang.Thread.run(Thread.java:745)
> Caused by: ERROR 22018: Invalid character string format for type long.
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:290)
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:285)
>   at org.apache.derby.iapi.types.SQLChar.getLong(SQLChar.java:447)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRows(UpdateResultSet.java:534)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.open(UpdateResultSet.java:272)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:473)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:352)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1340)
>   ... 13 more
> Further details and discussion can be found here:
> https://mail-archives.apache.org/mod_mbox/db-derby-user/201603.mbox/%3CCAHbUnCXkHMKE1u9R3D-z9Njp8goAV7%2B0vPOmgafH8DCqG8mSpQ%40mail.gmail.com%3E
> Notably, I have tried executing the same update via other means (for example, 
> manually via SquirrelSQL, and via the ORMLite framework) and the update 
> succeeds. This may be due to the exact JDBC APIs they are using (for example, 
> SquirrelSQL is not using a prepared statement, and ORMLite updates all the 
> columns when it updates a table rather than just some of them).
> I have created a complete but minimal example that illustrates the problem in 
> the following GitHub project:
> https://github.com/ssadedin/DerbyDebug
> My derby / system information is as follows:
> $ java -cp 'lib/*' org.apache.derby.tools.sysinfo
> -- Java Information --
> Java Version:1.8.0_72
> Java Vendor: Oracle Corporation
> Java home:   
> /Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre
> Java classpath:  lib/derby.jar:lib/derbyclient.jar
> OS 

[jira] [Commented] (DERBY-6880) Update failing with java.sql.SQLDataException

2016-04-07 Thread Soren Peen (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15230293#comment-15230293
 ] 

Soren Peen commented on DERBY-6880:
---

In case you could use this info; 
I tried changing the PreparedStatement in the test to this:

{quote}
PreparedStatement ustmt = conn.prepareStatement(
"update pipeline_command set status = 'WAIT 
RESULT'" +
"   where id = ?", new 
String[] \{"ID"\});
{quote}

It results in the same error on Derby as before. But running this against DB2 
makes Statement.getGeneratedKeys return the ID of the updated row (In this test 
'2'). Running the original PreparedStatement against DB2 makes 
Statement.getGeneratedKeys return an empty resultsset.

> Update failing with java.sql.SQLDataException 
> --
>
> Key: DERBY-6880
> URL: https://issues.apache.org/jira/browse/DERBY-6880
> Project: Derby
>  Issue Type: Bug
>Affects Versions: 10.12.1.1
>Reporter: Simon Zee
> Attachments: repro.diff, standalone.java, undo6742.diff
>
>
> When updating a single column in a table using executeUpdate() via Vert.x I 
> am receiving the following exception:
> java.sql.SQLDataException: Invalid character string format for type long.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:84)
>   at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:233)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:424)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
>   at 
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2405)
>   at 
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:88)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1432)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1709)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(EmbedPreparedStatement.java:320)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:309)
>   at 
> com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:410)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:50)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:34)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:48)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:33)
>   at 
> io.vertx.core.impl.ContextImpl.lambda$executeBlocking$15(ContextImpl.java:296)
>   at 
> io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor.lambda$new$261(OrderedExecutorFactory.java:91)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>   at java.lang.Thread.run(Thread.java:745)
> Caused by: ERROR 22018: Invalid character string format for type long.
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:290)
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:285)
>   at org.apache.derby.iapi.types.SQLChar.getLong(SQLChar.java:447)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRows(UpdateResultSet.java:534)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.open(UpdateResultSet.java:272)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:473)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:352)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1340)
>   ... 13 more
> Further details and discussion can be found here:
> https://mail-archives.apache.org/mod_mbox/db-derby-user/201603.mbox/%3CCAHbUnCXkHMKE1u9R3D-z9Njp8goAV7%2B0vPOmgafH8DCqG8mSpQ%40mail.gmail.com%3E
> Notably, I have tried executing the same update via other means (for example, 
> manually via SquirrelSQL, and via the ORMLite framework) and the update 
> succeeds. This may be due to the exact JDBC APIs they are using (for example, 
> SquirrelSQL is not using a prepared statement, and ORMLite updates all the 
> columns when it updates a table rather than just some of them).
> I have created a complete but minimal example that illustrates the problem in 
> the 

[jira] [Commented] (DERBY-6880) Update failing with java.sql.SQLDataException

2016-04-06 Thread Bryan Pendleton (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15228281#comment-15228281
 ] 

Bryan Pendleton commented on DERBY-6880:


That's a really interesting perspective, thank you for suggesting it!

The JavaDoc in question, I think, is for Statement.getGeneratedKeys:
https://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#getGeneratedKeys()

It says:

Retrieves any auto-generated keys created as a result of executing this 
Statement object. If this Statement object did not generate any keys, 
an empty ResultSet object is returned.

Note:If the columns which represent the auto-generated keys were not 
specified, the JDBC driver implementation will determine the columns 
which best represent the auto-generated keys.

Which isn't a lot of detail. But, to me, it clearly uses the phrases

auto-generated keys created as a result

and

generate any keys

To me, that specifically means that the update must cause a *NEW* value for
a column which is "GENERATED ... AS IDENTITY" to be generated by the
statement, and the reproduction's statement:

update pipeline_command set status = 'WAIT RESULT' where id = ?

only updates the "status" column, and does not cause any new values to
be generated for the "id" column.

However, while doing a bit of web searching, I came across this page from
the DB2 documentation set:


https://www.ibm.com/support/knowledgecenter/SSEPGG_9.7.0/com.ibm.db2.luw.apdv.java.doc/src/tpc/imjcc_t0057054.html

which suggests a thoroughly different reading of how Statement.getGeneratedKeys
should behave, stating that:

The following code names the EMPNO column as an automatically 
generated key, updates the thirty rows in the EMP_BONUS table, 
and retrieves the values of EMPNO for the updated rows. 

The statement in the DB2 example, like the statement in this issue's 
reproduction,
does not modify nor create new values for any automatically generated keys, but
the DB2 example suggests that Statement.getGeneratedKeys is intended to
return the generated key values of *other* columns in the rows which were 
updated,
even if those columns where not actually created or updated by the statement.

It's a bit of a puzzle, actually. But, your comment does suggest some new test
cases that I might right (thank you!)

I'll try to find some time to dig into that some more.

In the meantime, if anyone knows of any more information about how 
Statement.getGeneratedKeys
is intended to behave, that would be welcomed.

> Update failing with java.sql.SQLDataException 
> --
>
> Key: DERBY-6880
> URL: https://issues.apache.org/jira/browse/DERBY-6880
> Project: Derby
>  Issue Type: Bug
>Affects Versions: 10.12.1.1
>Reporter: Simon Zee
> Attachments: repro.diff, standalone.java, undo6742.diff
>
>
> When updating a single column in a table using executeUpdate() via Vert.x I 
> am receiving the following exception:
> java.sql.SQLDataException: Invalid character string format for type long.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:84)
>   at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:233)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:424)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
>   at 
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2405)
>   at 
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:88)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1432)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1709)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(EmbedPreparedStatement.java:320)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:309)
>   at 
> com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:410)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:50)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:34)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:48)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:33)
>   at 
> io.vertx.core.impl.ContextImpl.lambda$executeBlocking$15(ContextImpl.java:296)
>   at 
> io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor.lambda$new$261(OrderedExecutorFactory.java:91)
>   at 
> 

[jira] [Commented] (DERBY-6880) Update failing with java.sql.SQLDataException

2016-04-05 Thread Soren Peen (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15225916#comment-15225916
 ] 

Soren Peen commented on DERBY-6880:
---

If I understand the javadoc describing the section you've tried commenting out, 
I think you should be able to get the identity value of the updated row after 
executing an update affecting a single row, like the one in the test.

So if you expand the test to also check the result of ustmt.getGeneratedKeys(), 
I think it will fail (always returns 0) when the section of code in 
UpdateResultSet.collectAffectedRows() is commented out.

> Update failing with java.sql.SQLDataException 
> --
>
> Key: DERBY-6880
> URL: https://issues.apache.org/jira/browse/DERBY-6880
> Project: Derby
>  Issue Type: Bug
>Affects Versions: 10.12.1.1
>Reporter: Simon Zee
> Attachments: repro.diff, standalone.java, undo6742.diff
>
>
> When updating a single column in a table using executeUpdate() via Vert.x I 
> am receiving the following exception:
> java.sql.SQLDataException: Invalid character string format for type long.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:84)
>   at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:233)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:424)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
>   at 
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2405)
>   at 
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:88)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1432)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1709)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(EmbedPreparedStatement.java:320)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:309)
>   at 
> com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:410)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:50)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:34)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:48)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:33)
>   at 
> io.vertx.core.impl.ContextImpl.lambda$executeBlocking$15(ContextImpl.java:296)
>   at 
> io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor.lambda$new$261(OrderedExecutorFactory.java:91)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>   at java.lang.Thread.run(Thread.java:745)
> Caused by: ERROR 22018: Invalid character string format for type long.
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:290)
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:285)
>   at org.apache.derby.iapi.types.SQLChar.getLong(SQLChar.java:447)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRows(UpdateResultSet.java:534)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.open(UpdateResultSet.java:272)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:473)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:352)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1340)
>   ... 13 more
> Further details and discussion can be found here:
> https://mail-archives.apache.org/mod_mbox/db-derby-user/201603.mbox/%3CCAHbUnCXkHMKE1u9R3D-z9Njp8goAV7%2B0vPOmgafH8DCqG8mSpQ%40mail.gmail.com%3E
> Notably, I have tried executing the same update via other means (for example, 
> manually via SquirrelSQL, and via the ORMLite framework) and the update 
> succeeds. This may be due to the exact JDBC APIs they are using (for example, 
> SquirrelSQL is not using a prepared statement, and ORMLite updates all the 
> columns when it updates a table rather than just some of them).
> I have created a complete but minimal example that illustrates the problem in 
> the following GitHub project:
> https://github.com/ssadedin/DerbyDebug
> My derby / system information is as follows:
> $ java -cp 'lib/*' org.apache.derby.tools.sysinfo
> -- Java 

[jira] [Commented] (DERBY-6880) Update failing with java.sql.SQLDataException

2016-04-02 Thread Simon Zee (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15223097#comment-15223097
 ] 

Simon Zee commented on DERBY-6880:
--

Thanks for all your work on this Bryan!

I applied the undo patch that you attached and that resolved the problem for 
me. I will leave this patched version in place and work with it over the next 
few days and report back if there are any regressions. 

> Update failing with java.sql.SQLDataException 
> --
>
> Key: DERBY-6880
> URL: https://issues.apache.org/jira/browse/DERBY-6880
> Project: Derby
>  Issue Type: Bug
>Affects Versions: 10.12.1.1
>Reporter: Simon Zee
> Attachments: repro.diff, standalone.java, undo6742.diff
>
>
> When updating a single column in a table using executeUpdate() via Vert.x I 
> am receiving the following exception:
> java.sql.SQLDataException: Invalid character string format for type long.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:84)
>   at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:233)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:424)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
>   at 
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2405)
>   at 
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:88)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1432)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1709)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(EmbedPreparedStatement.java:320)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:309)
>   at 
> com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:410)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:50)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:34)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:48)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:33)
>   at 
> io.vertx.core.impl.ContextImpl.lambda$executeBlocking$15(ContextImpl.java:296)
>   at 
> io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor.lambda$new$261(OrderedExecutorFactory.java:91)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>   at java.lang.Thread.run(Thread.java:745)
> Caused by: ERROR 22018: Invalid character string format for type long.
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:290)
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:285)
>   at org.apache.derby.iapi.types.SQLChar.getLong(SQLChar.java:447)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRows(UpdateResultSet.java:534)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.open(UpdateResultSet.java:272)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:473)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:352)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1340)
>   ... 13 more
> Further details and discussion can be found here:
> https://mail-archives.apache.org/mod_mbox/db-derby-user/201603.mbox/%3CCAHbUnCXkHMKE1u9R3D-z9Njp8goAV7%2B0vPOmgafH8DCqG8mSpQ%40mail.gmail.com%3E
> Notably, I have tried executing the same update via other means (for example, 
> manually via SquirrelSQL, and via the ORMLite framework) and the update 
> succeeds. This may be due to the exact JDBC APIs they are using (for example, 
> SquirrelSQL is not using a prepared statement, and ORMLite updates all the 
> columns when it updates a table rather than just some of them).
> I have created a complete but minimal example that illustrates the problem in 
> the following GitHub project:
> https://github.com/ssadedin/DerbyDebug
> My derby / system information is as follows:
> $ java -cp 'lib/*' org.apache.derby.tools.sysinfo
> -- Java Information --
> Java Version:1.8.0_72
> Java Vendor: Oracle Corporation
> Java home:   
> /Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre

[jira] [Commented] (DERBY-6880) Update failing with java.sql.SQLDataException

2016-04-01 Thread Bryan Pendleton (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15222622#comment-15222622
 ] 

Bryan Pendleton commented on DERBY-6880:


One possibility is to back-out the change to UpdateResultSet made by DERBY-6742 
in 
revision https://svn.apache.org/r1628596. Of course, that would re-open 
DERBY-6742.


> Update failing with java.sql.SQLDataException 
> --
>
> Key: DERBY-6880
> URL: https://issues.apache.org/jira/browse/DERBY-6880
> Project: Derby
>  Issue Type: Bug
>Affects Versions: 10.12.1.1
>Reporter: Simon Zee
> Attachments: repro.diff, standalone.java
>
>
> When updating a single column in a table using executeUpdate() via Vert.x I 
> am receiving the following exception:
> java.sql.SQLDataException: Invalid character string format for type long.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:84)
>   at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:233)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:424)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
>   at 
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2405)
>   at 
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:88)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1432)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1709)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(EmbedPreparedStatement.java:320)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:309)
>   at 
> com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:410)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:50)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:34)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:48)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:33)
>   at 
> io.vertx.core.impl.ContextImpl.lambda$executeBlocking$15(ContextImpl.java:296)
>   at 
> io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor.lambda$new$261(OrderedExecutorFactory.java:91)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>   at java.lang.Thread.run(Thread.java:745)
> Caused by: ERROR 22018: Invalid character string format for type long.
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:290)
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:285)
>   at org.apache.derby.iapi.types.SQLChar.getLong(SQLChar.java:447)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRows(UpdateResultSet.java:534)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.open(UpdateResultSet.java:272)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:473)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:352)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1340)
>   ... 13 more
> Further details and discussion can be found here:
> https://mail-archives.apache.org/mod_mbox/db-derby-user/201603.mbox/%3CCAHbUnCXkHMKE1u9R3D-z9Njp8goAV7%2B0vPOmgafH8DCqG8mSpQ%40mail.gmail.com%3E
> Notably, I have tried executing the same update via other means (for example, 
> manually via SquirrelSQL, and via the ORMLite framework) and the update 
> succeeds. This may be due to the exact JDBC APIs they are using (for example, 
> SquirrelSQL is not using a prepared statement, and ORMLite updates all the 
> columns when it updates a table rather than just some of them).
> I have created a complete but minimal example that illustrates the problem in 
> the following GitHub project:
> https://github.com/ssadedin/DerbyDebug
> My derby / system information is as follows:
> $ java -cp 'lib/*' org.apache.derby.tools.sysinfo
> -- Java Information --
> Java Version:1.8.0_72
> Java Vendor: Oracle Corporation
> Java home:   
> /Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre
> Java classpath:  lib/derby.jar:lib/derbyclient.jar
> OS name: Mac OS X
> OS 

[jira] [Commented] (DERBY-6880) Update failing with java.sql.SQLDataException

2016-04-01 Thread Bryan Pendleton (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15222616#comment-15222616
 ] 

Bryan Pendleton commented on DERBY-6880:


Here's a snip from the change that was submitted for DERBY-6414:


+ *  The 2nd array, rla has a spot for each of the columns in the table, 
+ *  with non null value for auto generated column. But in case of Update,
+ *  resultDescription does not include all the columns in the table. It
+ *  only has the columns being touched by the Update statement(the rest of
+ *  the columns in the table will retain their original values), and for 
+ *  each of those touched columns, it has a duplicate entry in 
+ *  resultDescription in order to have before and after values for the 
+ *  changed column values. Lastly, it has a row location information for 
+ *  the row being updated. This difference in array content of 
+ *  resultDescription requires us to have separate implementation of this
+ *  method for insert and update.


I think this description (before and after values for the changed column values,
plus the row location information for the row being updated) exactly describes
the 3-column ValueRow object that I am seeing when I run the reproduction.

I have the before and after values for the 'status' column as columns 1 and 2
of my 3-column row, and the third column (1,8) is the row location information.


> Update failing with java.sql.SQLDataException 
> --
>
> Key: DERBY-6880
> URL: https://issues.apache.org/jira/browse/DERBY-6880
> Project: Derby
>  Issue Type: Bug
>Affects Versions: 10.12.1.1
>Reporter: Simon Zee
> Attachments: repro.diff, standalone.java
>
>
> When updating a single column in a table using executeUpdate() via Vert.x I 
> am receiving the following exception:
> java.sql.SQLDataException: Invalid character string format for type long.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:84)
>   at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:233)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:424)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
>   at 
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2405)
>   at 
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:88)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1432)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1709)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(EmbedPreparedStatement.java:320)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:309)
>   at 
> com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:410)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:50)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:34)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:48)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:33)
>   at 
> io.vertx.core.impl.ContextImpl.lambda$executeBlocking$15(ContextImpl.java:296)
>   at 
> io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor.lambda$new$261(OrderedExecutorFactory.java:91)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>   at java.lang.Thread.run(Thread.java:745)
> Caused by: ERROR 22018: Invalid character string format for type long.
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:290)
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:285)
>   at org.apache.derby.iapi.types.SQLChar.getLong(SQLChar.java:447)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRows(UpdateResultSet.java:534)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.open(UpdateResultSet.java:272)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:473)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:352)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1340)
>   ... 13 more
> Further details and discussion 

[jira] [Commented] (DERBY-6880) Update failing with java.sql.SQLDataException

2016-03-31 Thread Bryan Pendleton (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15221076#comment-15221076
 ] 

Bryan Pendleton commented on DERBY-6880:


In the code:

{code}
for(col=1;col<=maxColumns;col++)
{
ColumnDescriptor cd = td.getColumnDescriptor(col);
if(cd.isAutoincrement())
{
break;
}
}

if(col <= maxColumns)
{
DataValueDescriptor dvd = row.cloneColumn(col);
identityVal = dvd.getLong();
}
{code}

is where we go astray. The for loop locates the correct column descriptor,
it is for the "id" column of table "pipeline_command".

But the table descriptor in "td" is not accurate for use with the data in "row".

In this particular case, "td" describes the underlying "pipeline_command" table,
and it appears to have all the relevant columns just as you would expect, and
so column 1 is indeed the autogenerated "ID" column.

However, column 1 of "row" is nothing the same at all. "row" is a ValueRow,
and has only 3 columns, in my case the three columns are:
  - the old value of the "status" column
  - the new value of the "status" column
  - some sort of value that is displayed as "(1,8)", which I haven't decoded 
yet.

I think that "row", at the time when we are running, is some sort of 
intermediate
object, and the code in UpdateResultSet is getting all confused because it
is trying to use the underlying table descriptor to interpret the values in 
"row",
but "row" is not a row from the base "pipeline_command" table anymore, it is
some intermediate "old-value,new-value" row that has been constructed by the 
query.

Anyway, that's as far as I got today fooling around with the reproduction 
script.


> Update failing with java.sql.SQLDataException 
> --
>
> Key: DERBY-6880
> URL: https://issues.apache.org/jira/browse/DERBY-6880
> Project: Derby
>  Issue Type: Bug
>Affects Versions: 10.12.1.1
>Reporter: Simon Zee
> Attachments: repro.diff
>
>
> When updating a single column in a table using executeUpdate() via Vert.x I 
> am receiving the following exception:
> java.sql.SQLDataException: Invalid character string format for type long.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:84)
>   at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:233)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:424)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
>   at 
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2405)
>   at 
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:88)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1432)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1709)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(EmbedPreparedStatement.java:320)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:309)
>   at 
> com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:410)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:50)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:34)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:48)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:33)
>   at 
> io.vertx.core.impl.ContextImpl.lambda$executeBlocking$15(ContextImpl.java:296)
>   at 
> io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor.lambda$new$261(OrderedExecutorFactory.java:91)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>   at java.lang.Thread.run(Thread.java:745)
> Caused by: ERROR 22018: Invalid character string format for type long.
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:290)
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:285)
>   at org.apache.derby.iapi.types.SQLChar.getLong(SQLChar.java:447)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRows(UpdateResultSet.java:534)
>   at 
> 

[jira] [Commented] (DERBY-6880) Update failing with java.sql.SQLDataException

2016-03-31 Thread Bryan Pendleton (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15220950#comment-15220950
 ] 

Bryan Pendleton commented on DERBY-6880:


The code which calls getLong, provoking the exception,
is new code added by DERBY-6742, so marking this
issue as linked to that one.

> Update failing with java.sql.SQLDataException 
> --
>
> Key: DERBY-6880
> URL: https://issues.apache.org/jira/browse/DERBY-6880
> Project: Derby
>  Issue Type: Bug
>Affects Versions: 10.12.1.1
>Reporter: Simon Zee
> Attachments: repro.diff
>
>
> When updating a single column in a table using executeUpdate() via Vert.x I 
> am receiving the following exception:
> java.sql.SQLDataException: Invalid character string format for type long.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:84)
>   at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:233)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:424)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
>   at 
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2405)
>   at 
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:88)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1432)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1709)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(EmbedPreparedStatement.java:320)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:309)
>   at 
> com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:410)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:50)
>   at io.vertx.ext.jdbc.impl.actions.JDBCUpdate.execute(JDBCUpdate.java:34)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:48)
>   at 
> io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:33)
>   at 
> io.vertx.core.impl.ContextImpl.lambda$executeBlocking$15(ContextImpl.java:296)
>   at 
> io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor.lambda$new$261(OrderedExecutorFactory.java:91)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>   at java.lang.Thread.run(Thread.java:745)
> Caused by: ERROR 22018: Invalid character string format for type long.
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:290)
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:285)
>   at org.apache.derby.iapi.types.SQLChar.getLong(SQLChar.java:447)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRows(UpdateResultSet.java:534)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.open(UpdateResultSet.java:272)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:473)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:352)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1340)
>   ... 13 more
> Further details and discussion can be found here:
> https://mail-archives.apache.org/mod_mbox/db-derby-user/201603.mbox/%3CCAHbUnCXkHMKE1u9R3D-z9Njp8goAV7%2B0vPOmgafH8DCqG8mSpQ%40mail.gmail.com%3E
> Notably, I have tried executing the same update via other means (for example, 
> manually via SquirrelSQL, and via the ORMLite framework) and the update 
> succeeds. This may be due to the exact JDBC APIs they are using (for example, 
> SquirrelSQL is not using a prepared statement, and ORMLite updates all the 
> columns when it updates a table rather than just some of them).
> I have created a complete but minimal example that illustrates the problem in 
> the following GitHub project:
> https://github.com/ssadedin/DerbyDebug
> My derby / system information is as follows:
> $ java -cp 'lib/*' org.apache.derby.tools.sysinfo
> -- Java Information --
> Java Version:1.8.0_72
> Java Vendor: Oracle Corporation
> Java home:   
> /Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre
> Java classpath:  lib/derby.jar:lib/derbyclient.jar
> OS name: Mac OS X
> OS architecture: x86_64
> OS version:  10.11.1
> Java