[
https://issues.apache.org/jira/browse/DERBY-2066?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rick Hillegas updated DERBY-2066:
---------------------------------
Attachment: derby-2066-01-aa-makeMessageIDaSQLState.diff
Attaching derby-2066-01-aa-makeMessageIDaSQLState.diff. This results in a
reasonable error message for this situation. I will run regression tests.
I don't propose to commit this patch before creating the 10.8 branch. I would
like to give people time to consider whether there are any problems with this
solution:
The worthless error message arises because the error condition creates a
SQLException with no SQLState. In various places the network driver assumes
that all SQLExceptions have SQLStates. In one place the network driver assumes
that a SQLState will have exactly 5 characters. If these assumptions aren't
true, then the protocol trips over NPEs and array bounds exceptions and coughs
up the worthless error message seen in this bug report.
Although I can fault the driver's graceless handling of violated assumptions, I
think that it is reasonable to insist that all SQLExceptions have 5 character
SQLStates.
The "unregistered driver" error is raised twice in Derby code. In both cases it
surfaces as a SQLException without a SQLState. The actual message handle for
this error lives in MessageId.java. Comments in that class indicate that it is
only for messages which DON'T appear in SQLExceptions.
I fixed the problem as follows:
1) Moved the "unregistered driver" message from MessageId into SQLState. Along
the way I gave it a new message handle and placed it in a block with other
connection errors.
2) Adjusted messages.xml accordingly.
3) Changed the two places which raise this SQLException to also include the
SQLState.
If this seems like a reasonable way to ungarble this problem, then I think it
would be worthwhile to examine MessageId to see if it contains other errors
which are really surfacing as SQLExceptions. Those errors should get valid
SQLStates and should move to SQLState.java too.
Touches the following files:
----------
M java/engine/org/apache/derby/loc/messages.xml
M java/shared/org/apache/derby/shared/common/reference/SQLState.java
M java/shared/org/apache/derby/shared/common/reference/MessageId.java
Make the "unregistered driver" error a SQLState rather than a MessageId.
----------
M java/engine/org/apache/derby/jdbc/EmbeddedSimpleDataSource.java
M java/engine/org/apache/derby/jdbc/AutoloadedDriver.java
Include a SQLState in the "unregistered driver" SQLException.
> DisconnectException: The DDM object 0x1232 is not supported following
> shutdown of embedded engine while network server is running
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-2066
> URL: https://issues.apache.org/jira/browse/DERBY-2066
> Project: Derby
> Issue Type: Bug
> Components: Network Client, Network Server
> Affects Versions: 10.3.1.4
> Environment: JDK 142 windows
> Reporter: Daniel John Debrunner
> Labels: derby_triage10_5_2
> Attachments: Test_2066.java,
> derby-2066-01-aa-makeMessageIDaSQLState.diff
>
>
> Running all within the same JVM.
> start network server using api
> connect to database using client
> close connection
> shutdown engine (not network server) using jdbc:derby:;shutdown=true
> connect to database using client - FAILS
> Caused by: org.apache.derby.client.am.DisconnectException: The DDM object
> 0x1232 is not supported. The connection has been terminated.
> at
> org.apache.derby.client.net.NetConnectionReply.doObjnsprmSemantics(Unknown
> Source)
> at
> org.apache.derby.client.net.NetConnectionReply.parseCommonError(Unknown
> Source)
> at
> org.apache.derby.client.net.NetConnectionReply.parseSecurityCheckError(Unknown
> Source)
> at
> org.apache.derby.client.net.NetConnectionReply.parseSECCHKreply(Unknown
> Source)
> at
> org.apache.derby.client.net.NetConnectionReply.readSecurityCheck(Unknown
> Source)
> at
> org.apache.derby.client.net.NetConnection.readSecurityCheckAndAccessRdb(Unknown
> Source)
> at
> org.apache.derby.client.net.NetConnection.flowSecurityCheckAndAccessRdb(Unknown
> Source)
> at
> org.apache.derby.client.net.NetConnection.flowUSRIDPWDconnect(Unknown Source)
> at org.apache.derby.client.net.NetConnection.flowConnect(Unknown Source)
> at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
> at
> org.apache.derby.client.net.ClientJDBCObjectFactoryImpl.newNetConnection(Unknown
> Source)
> ... 33 more
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira