[
https://issues.apache.org/jira/browse/DERBY-1191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kathey Marsden updated DERBY-1191:
----------------------------------
Attachment: derby-1191_checkForTransactionInProgress_diff.txt
Here is a patch that takes the approach of adding a public static void
logAndThrowSQLException(SQLException se) method and then calling that instead
of just throwing the exception.
The initial patch only uses the method for
EmbedConnection.checkForTransactionInProgress() which is the most important
exception to log after the fix for DERBY-3319.
If everyone agrees on the approach, I would like to commit this patch and
backport it to 10.5 and then follow up with larger patches that use the method
for other SQLExceptions thrown by Derby embedded JDBC and network server.
I am running regression tests now. I manually tested that the exception gets
logged always with a sane build and with the appropriate
derby.stream.error.logSeverityLevel with an insane build. I didn't add a
regression test because we don't really have a good way I think to test error
log contents.
> Some SQLExceptions, for example those generated from BrokeredStatements, do
> not print to derby.log even when derby.stream.error.logSeverityLevel=0
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-1191
> URL: https://issues.apache.org/jira/browse/DERBY-1191
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Affects Versions: 10.1.3.1, 10.2.1.6
> Reporter: Kathey Marsden
> Attachments: derby-1191_checkForTransactionInProgress_diff.txt,
> derby-1191_factory_hack_no_commit_diff.txt, ReproDerby1191.java
>
>
> I found this when working on DERBY-1047. Exceptions thrown using
> org.apache.derby.impl.jdbc.Util.generateCsSQLException()
> do not print to derby.log even when derby.stream.error.logSeverityLevel=0
> For example the attached repro generates an expected exception but does not
> print the error to the log.
> java -Dderby.stream.error.logSeverityLevel=0 Derby1047
> This causes an expected exception to be thrown but it does not print to the
> derby.log
> 10.2.0.0 alpha
> Apache Derby
> Apache Derby Embedded JDBC Driver
> done creating table
> COL1
> -----------
> 1
> 2
> PASS: Expected Exception can'tholdable cusror in global xact:Cannot set
> holdability ResultSet.HOLD_CURSORS_OVER_COMMIT for a global transaction.
> COL1
> -----------
> 1
> 2
> 3
> The code generating the exception is in
> org.apache.derby.iapi.jdbc.BrokeredStatement
> final void checkHoldability() throws SQLException {
> int holdability =
> controlCheck().checkHoldCursors(resultSetHoldability);
> if (holdability != resultSetHoldability)
> throw Util.generateCsSQLException(SQLState.CANNOT_HOLD_CURSOR_XA);
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.