ResultSetMetaData.getPrecision of a numeric column when no transaction is active throws an SQLException [JDBC464] #503
Labels
affect-version: Jaybird 2.2.7
affect-version: Jaybird 2.2.8
affect-version: Jaybird 2.2.9
affect-version: Jaybird 2.2.10
affect-version: Jaybird 2.2.11
affect-version: Jaybird 3.0.0-beta-1
component: jdbc driver
fix-version: Jaybird 2.2.12
fix-version: Jaybird 3.0.0-beta-2
fix-version: Jaybird 3.0.0
priority: major
resolution: fixed
type: bug
Submitted by: @mrotteveel
Relate to JDBC465
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 44c59d8 9227333 272f8fd fb66511 1b7e96f 2a9c215
The text was updated successfully, but these errors were encountered: