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
JDBC 4.0 compliant Exception chaining [JDBC139] #180
Comments
Modified by: Roman Rokytskyy (rrokytskyy)Fix Version: Jaybird 2.2 [ 10053 ] timeestimate: 0 [ 0 ] timeoriginalestimate: 0 [ 0 ] |
Commented by: Roman Rokytskyy (rrokytskyy) Seems that we can fix it with simply deprecating the getInternalError() method and returning the original exception as the cause. Can you please confirm this or provide a test case against which the driver can be checked? |
Modified by: Roman Rokytskyy (rrokytskyy)status: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] |
Commented by: @mrotteveel I will see if I can look into this in the coming week. |
Commented by: Roman Rokytskyy (rrokytskyy) A test case would be great! |
Commented by: @mrotteveel I have looked over the code and it looks OK to me. I have not created a testcase. instead I propose a patch which will greatly simplify FBSQLException and delegates more to the SQLException superclass and Throwable (obviating the need for a Firebird specific testcase as the behavior will be general Java). See the attached patch file. What the patch does: |
Modified by: @mrotteveelAttachment: FBSQLException-patch.txt [ 11582 ] |
Commented by: @mrotteveel Reopen to integrate patch |
Modified by: @mrotteveelassignee: Roman Rokytskyy [ rrokytskyy ] => Mark Rotteveel [ avalanche1979 ] status: Resolved [ 5 ] => Reopened [ 4 ] resolution: Fixed [ 1 ] => |
Modified by: @mrotteveelstatus: Reopened [ 4 ] => In Progress [ 3 ] |
Commented by: @mrotteveel Committed patch and some additional improvements to delegate more to superclass. |
Commented by: @mrotteveel Missed two cases were the isc errorcode should be set. Committed correction. |
Modified by: @mrotteveelstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: @mrotteveel
Attachments:
FBSQLException-patch.txt
Jaybird currently does not conform to JDBC 3.0 / JDBC 4.0 in respect to Exception chaining, and uses it's own method of chaining.
For JDBC 3.0 conformance, exception chaining using setNextException() / getNextException() should be implemented as specified in paragraph 8.1 of the JDBC 3.0 specification (these methods should only accept and return SQLException and descendants)
For JDBC 4.0 conformance, the Java 1.4 cause facility (exception chaining) as described in http://java.sun.com/javase/6/docs/api/java/lang/Throwable.html should be implemented and the exception chaining defined in JDBC 3.0 has been enhanced, see paragraph 8.1 in the JDBC 4.0 specification.
This enhancement includes navigation of the SQLExceptions and their causes using an iterator that returns SQLExceptions in order (as also defined by getNextException), including the Throwable chain defined by getCause(). See also http://java.sun.com/javase/6/docs/api/java/sql/SQLException.html
Implementing JDBC 4.0 should be enough to also result in JDBC 3.0 conformance.
JDBC specifications: http://java.sun.com/products/jdbc/download.html
Commits: 137db3e 36f0cc9 2ebf669
The text was updated successfully, but these errors were encountered: