forked from dork/tarantool-java
-
Notifications
You must be signed in to change notification settings - Fork 19
jdbc: support categorized exceptions and SQLSTATE codes #119
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
Comments
nicktorwald
pushed a commit
that referenced
this issue
Mar 19, 2019
Right now we only can support HOLD_CURSORS_OVER_COMMIT due to lack of Tarantool transaction support and, possibly, cursors. So, in terms of HOLD_CURSORS_OVER_COMMIT we always load a result set completely and it can be used as long as it is opened. Implement the holdability support (next HS) for SQLDatabaseMetaData in part of getting a default holdability and checking proper support. Implement HS for SQLConnection in part of producing new statements and prepared statements (but excluding CallableStatements due to lack of implementation). Implement HS for SQL(Prepared)Statement as well as for SQLResultSet which is produced by the statements. Some part of this feature requires the implementation of java.sql.Wrapper for SQLConnection and SQL(Prepared)Statement. So now they fully implement the interface. Add missed checks for an open status of JDBC components which are required by the specification. Some methods start returning appropriate SQLException subclasses when corresponding errors occur. Add SQLStates enumeration to help to produce the errors with the standard SQL states. Finally, JDBCBridge is no longer aware of the SQLResultSet class. Only Statement implementations are responsible for building of new result sets according to the specification design. Next plan is to completely avoid JDBCBridge logic and transfer it to an inner helper inside the Statement implementations. Closes: #87 Affects: #73, #119
Totktonada
pushed a commit
that referenced
this issue
Mar 21, 2019
Right now we only can support HOLD_CURSORS_OVER_COMMIT due to lack of Tarantool transaction support and, possibly, cursors. So, in terms of HOLD_CURSORS_OVER_COMMIT we always load a result set completely and it can be used as long as it is opened. Implement the holdability support (next HS) for SQLDatabaseMetaData in part of getting a default holdability and checking proper support. Implement HS for SQLConnection in part of producing new statements and prepared statements (but excluding CallableStatements due to lack of implementation). Implement HS for SQL(Prepared)Statement as well as for SQLResultSet which is produced by the statements. Some part of this feature requires the implementation of java.sql.Wrapper for SQLConnection and SQL(Prepared)Statement. So now they fully implement the interface. Add missed checks for an open status of JDBC components which are required by the specification. Some methods start returning appropriate SQLException subclasses when corresponding errors occur. Add SQLStates enumeration to help to produce the errors with the standard SQL states. Finally, JDBCBridge is no longer aware of the SQLResultSet class. Only Statement implementations are responsible for building of new result sets according to the specification design. Next plan is to completely avoid JDBCBridge logic and transfer it to an inner helper inside the Statement implementations. Closes: #87 Affects: #73, #119
nicktorwald
added a commit
that referenced
this issue
Apr 5, 2019
Provide support for FORWARD_ONLY and INSENSITIVE scroll types. Now statements as well as theirs resultSets can be built using a forward only iterator or full implemented insensitive iterator. To achieve this iteration logic was extracted into two separate classes to support two scroll types respectively. This is a cross-cutting support through SQLMetadata, SQLConnection, SQL(Prepared)Statement, SQLResultSet. Extend SQLStates constants. '24000' state was added in scope of iterator support. Add missed implementation of a closing for SQLStatement and SQLResultSet. Deprecate JDBCBridge. This redundant class should be removed completely in scope of another task. Mapping of field labels was moved to SQLResultSet. Closes: #85 Affectes: #119, #108
nicktorwald
added a commit
that referenced
this issue
Apr 6, 2019
Provide support for FORWARD_ONLY and INSENSITIVE scroll types. Now statements as well as theirs resultSets can be built using a forward only iterator or full implemented insensitive iterator. To achieve this iteration logic was extracted into two separate classes to support two scroll types respectively. This is a cross-cutting support through SQLMetadata, SQLConnection, SQL(Prepared)Statement, SQLResultSet. Add support for READ_ONLY concurrency level for a result set. Extend SQLStates constants in scope of cursors and query execution. 0100E and 02000 for query results; 24000 for cursor iteration support. Add missed implementation of a closing for SQLStatement and SQLResultSet. Deprecate JDBCBridge. This redundant class should be removed completely in scope of another task. Mapping of field labels was moved to SQLResultSet. Closes: #85, #86 Affects: #119, #108
nicktorwald
added a commit
that referenced
this issue
Apr 7, 2019
Provide support for FORWARD_ONLY and INSENSITIVE scroll types. Now statements as well as theirs resultSets can be built using a forward only iterator or full implemented insensitive iterator. To achieve this iteration logic was extracted into two separate classes to support two scroll types respectively. This is a cross-cutting support through SQLMetadata, SQLConnection, SQL(Prepared)Statement, SQLResultSet. Add support for READ_ONLY concurrency level for a result set. Extend SQLStates constants in scope of cursors and query execution. 0100E and 02000 for query results; 24000 for cursor iteration support. Add missed implementation of a closing for SQLStatement and SQLResultSet. Deprecate JDBCBridge. This redundant class should be removed completely in scope of another task. Mapping of field labels was moved to SQLResultSet. Closes: #85, #86 Affects: #119, #108
nicktorwald
added a commit
that referenced
this issue
Apr 8, 2019
Add missed checks on methods of the closed connection. Add basic implementation Connection.isValid method to check a connection state sending a simple ping request. A support of the timeout param requires implementation of timer task per statement and comes out of the scope this issue. Closes: #72 Affects: #119
nicktorwald
added a commit
that referenced
this issue
Apr 8, 2019
Add missed checks on methods of the closed connection. Add basic implementation Connection.isValid method to check a connection state sending a simple ping request. A support of the timeout param requires implementation of timer task per statement and comes out of the scope this issue. Closes: #72 Affects: #119
nicktorwald
added a commit
that referenced
this issue
Apr 16, 2019
Provide support for FORWARD_ONLY and INSENSITIVE scroll types. Now statements as well as theirs resultSets can be built using a forward only iterator or full implemented insensitive iterator. To achieve this iteration logic was extracted into two separate classes to support two scroll types respectively. This is a cross-cutting support through SQLMetadata, SQLConnection, SQL(Prepared)Statement, SQLResultSet. Add support for READ_ONLY concurrency level for a result set. Extend SQLStates constants in scope of cursors and query execution. 0100E and 02000 for query results; 24000 for cursor iteration support. Add missed implementation of a closing for SQLStatement and SQLResultSet. Deprecate JDBCBridge. This redundant class should be removed completely in scope of another task. Mapping of field labels was moved to SQLResultSet. Closes: #85, #86 Affects: #119, #108
nicktorwald
added a commit
that referenced
this issue
Apr 16, 2019
Provide support for FORWARD_ONLY and INSENSITIVE scroll types. Now statements as well as theirs resultSets can be built using a forward only iterator or full implemented insensitive iterator. To achieve this iteration logic was extracted into two separate classes to support two scroll types respectively. This is a cross-cutting support through SQLMetadata, SQLConnection, SQL(Prepared)Statement, SQLResultSet. Add support for READ_ONLY concurrency level for a result set. Extend SQLStates constants in scope of cursors and query execution. 0100E and 02000 for query results; 24000 for cursor iteration support. Add missed implementation of a closing for SQLStatement and SQLResultSet. Deprecate JDBCBridge. This redundant class should be removed completely in scope of another task. Mapping of field labels was moved to SQLResultSet. Closes: #85, #86 Affects: #119, #108
nicktorwald
added a commit
that referenced
this issue
Apr 17, 2019
Provide support for FORWARD_ONLY and INSENSITIVE scroll types. Now statements as well as theirs resultSets can be built using a forward only iterator or full implemented insensitive iterator. To achieve this iteration logic was extracted into two separate classes to support two scroll types respectively. This is a cross-cutting support through SQLMetadata, SQLConnection, SQL(Prepared)Statement, SQLResultSet. Add support for READ_ONLY concurrency level for a result set. Extend SQLStates constants in scope of cursors and query execution. 0100E and 02000 for query results; 24000 for cursor iteration support. Add missed implementation of a closing for SQLStatement and SQLResultSet. Deprecate JDBCBridge. This redundant class should be removed completely in scope of another task. Mapping of field labels was moved to SQLResultSet. Closes: #85, #86 Affects: #119, #108
nicktorwald
added a commit
that referenced
this issue
Apr 17, 2019
Provide support for FORWARD_ONLY and INSENSITIVE scroll types. Now statements as well as theirs resultSets can be built using a forward only iterator or full implemented insensitive iterator. To achieve this iteration logic was extracted into two separate classes to support two scroll types respectively. This is a cross-cutting support through SQLMetadata, SQLConnection, SQL(Prepared)Statement, SQLResultSet. Add support for READ_ONLY concurrency level for a result set. Extend SQLStates constants in scope of cursors and query execution. 0100E and 02000 for query results; 24000 for cursor iteration support. Add missed implementation of a closing for SQLStatement and SQLResultSet. Deprecate JDBCBridge. This redundant class should be removed completely in scope of another task. Mapping of field labels was moved to SQLResultSet. Closes: #85, #86 Affects: #119, #108
We use As I see from other JDBC implementations (mysql-connector-j, mariadb-connector-j, pgjdbc), it seems we don't obligated to set an sqlstate code for each thrown SQLException. |
nicktorwald
added a commit
that referenced
this issue
Dec 5, 2019
Now we use SQLSTATE codes in most of the exceptional cases. To be consistent with it we need to return an appropriate value from the database metadata. This commit changes the constant that says the driver works with SQLSTATE codes rather than XOpen ones. Closes #119
Totktonada
pushed a commit
that referenced
this issue
Apr 27, 2020
Now we use SQLSTATE codes in most of the exceptional cases. To be consistent with it we need to return an appropriate value from the database metadata. This commit changes the constant that says the driver works with SQLSTATE codes rather than XOpen ones. Closes #119
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Return
sqlStateSQL
orsqlStateSQL99
(they are equal) fromDatabaseMetaData.getSQLStateType()
. Now the value is 0, which is not correct.Use SQLSTATE codes in SQLException where appropriate.
Use categorized SQL exceptions where possible:
Consider also using of BatchUpdateException and SQLClientInfoException.
Test all this new stuff.
See also: https://docs.oracle.com/javase/tutorial/jdbc/basics/sqlexception.html
This issue is mostly optional (AFAIU), but
DatabaseMetaData.getSQLStateType()
should provide a correct value.The text was updated successfully, but these errors were encountered: