New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLONE -ResultSetMetaData.getPrecision of a numeric column when no transaction is active throws an SQLException [JDBC470] #509
Comments
Modified by: @mrotteveel |
Modified by: @mrotteveelVersion: Jaybird 3.0.0-beta-2 [ 10802 ] Fix Version: Jaybird 2.2.13 [ 10805 ] description: If ResultSetMetaData.getPrecision is called for a numeric or decimal column while no transaction is active (and the method wasn't called earlier when a transaction was active for the same RSMD), then this will fail with an exception. The cause is that RSMD will execute the query, but as the FBConnection is not accessible in the context, it can only piggyback on an existing transaction instead of starting a new one. We should change this so it can either start a new normal transaction, or start a separate transaction for this metadata query (and commit that asap). Also investigate if similar problems occur elsewhere (prime candidates are where the constructor FBDatabaseMetaData(GDSHelper gdsHelper) is used instead of FBDatabaseMetaData(AbstractConnection c). Exception in 3.0 beta 1: java.sql.SQLNonTransientException: No transaction or transaction not ACTIVE
Exception in Jaybird 2.2.x: org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544332. invalid transaction handle (expecting explicit transaction start)
Caused by: org.firebirdsql.gds.GDSException: invalid transaction handle (expecting explicit transaction start) => The fix of JDBC464 didn't fix all cases. If ResultSetMetaData.getPrecision is called for a numeric or decimal column while no transaction is active (and the method wasn't called earlier when a transaction was active for the same RSMD), then this will fail with an exception. The cause is that RSMD will execute the query, but as the FBConnection is not accessible in the context, it can only piggyback on an existing transaction instead of starting a new one. We should change this so it can either start a new normal transaction, or start a separate transaction for this metadata query (and commit that asap). Also investigate if similar problems occur elsewhere (prime candidates are where the constructor FBDatabaseMetaData(GDSHelper gdsHelper) is used instead of FBDatabaseMetaData(AbstractConnection c). Exception in 3.0 beta 1: java.sql.SQLNonTransientException: No transaction or transaction not ACTIVE
Exception in Jaybird 2.2.x: org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544332. invalid transaction handle (expecting explicit transaction start)
Caused by: org.firebirdsql.gds.GDSException: invalid transaction handle (expecting explicit transaction start) Fix Version: Jaybird 2.2.12 [ 10781 ] => Fix Version: Jaybird 3.0.0-beta-2 [ 10802 ] => |
Commented by: @mrotteveel The exception could still occur when a connection was in use by another thread when the meta data statement was prepared. |
Modified by: @mrotteveelFix Version: Jaybird 3.0.0-beta-3 [ 10806 ] |
Commented by: @mrotteveel Fixed thread safety issue caused by insufficient synchronization |
Modified by: @mrotteveelstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: @mrotteveel
Relate to JDBC465
The fix of JDBC464 didn't fix all cases.
If ResultSetMetaData.getPrecision is called for a numeric or decimal column while no transaction is active (and the method wasn't called earlier when a transaction was active for the same RSMD), then this will fail with an exception.
The cause is that RSMD will execute the query, but as the FBConnection is not accessible in the context, it can only piggyback on an existing transaction instead of starting a new one. We should change this so it can either start a new normal transaction, or start a separate transaction for this metadata query (and commit that asap).
Also investigate if similar problems occur elsewhere (prime candidates are where the constructor FBDatabaseMetaData(GDSHelper gdsHelper) is used instead of FBDatabaseMetaData(AbstractConnection c).
Exception in 3.0 beta 1:
java.sql.SQLNonTransientException: No transaction or transaction not ACTIVE
Exception in Jaybird 2.2.x:
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544332. invalid transaction handle (expecting explicit transaction start)
Caused by: org.firebirdsql.gds.GDSException: invalid transaction handle (expecting explicit transaction start)
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.validateHandle(AbstractJavaGDSImpl.java:3246)
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.iscDsqlPrepare(AbstractJavaGDSImpl.java:1454)
at org.firebirdsql.gds.impl.GDSHelper.prepareStatement(GDSHelper.java:214)
at org.firebirdsql.jdbc.AbstractStatement.prepareFixedStatement(AbstractStatement.java:1388)
at org.firebirdsql.jdbc.AbstractPreparedStatement.prepareFixedStatement(AbstractPreparedStatement.java:1269)
at org.firebirdsql.jdbc.AbstractPreparedStatement.<init>(AbstractPreparedStatement.java:134)
... 41 more
Commits: 6ae0926 5f3cffa
The text was updated successfully, but these errors were encountered: