[CONJ-886] SQLState '08' is incorrectly mapped to SQLNonTransientConnectionException instead of SQLTransientConnectionException Created: 2021-05-31  Updated: 2021-07-26  Resolved: 2021-07-26

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 2.7.3
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Jaikiran Pai Assignee: Diego Dupin
Resolution: Not a Bug Votes: 0
Labels: None


 Description   

The javadoc of java.sql.SQLTransientConnectionException[1] states:
```
The subclass of SQLException for the SQLState class value '08', or under vendor-specified conditions.
```
So SQLState with value '08' is expected to be mapped to SQLTransientConnectionException. However, the JDBC driver code[2], currently maps it to SQLNonTransientConnectionException instead:

```
case "08":
returnEx = new SQLNonTransientConnectionException(msg, sqlState, errorCode, cause);
break;
```

[1] https://docs.oracle.com/javase/8/docs/api/java/sql/SQLTransientConnectionException.html
[2] https://github.com/mariadb-corporation/mariadb-connector-j/blob/master/src/main/java/org/mariadb/jdbc/util/exceptions/ExceptionFactory.java#L221



 Comments   
Comment by Jaikiran Pai [ 2021-05-31 ]

Never mind, it turns out the current code is correct because the `java.sql.SQLNonTransientConnectionException`[1] also says the same thing when it comes to the SQLState value:

```
The subclass of SQLException thrown for the SQLState class value '08', or under vendor-specified conditions.
```
Closing this issue as not a bug. Sorry about the noise.

[1] https://docs.oracle.com/javase/8/docs/api/java/sql/SQLNonTransientConnectionException.html

Comment by Jaikiran Pai [ 2021-05-31 ]

> Closing this issue as not a bug.

Looks like I can't do that. Please close this when you get a chance.

Generated at Thu Feb 08 03:19:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.