You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Kathey Marsden (JIRA)" <ji...@apache.org> on 2007/09/17 21:21:44 UTC

[jira] Commented: (DERBY-3077) Trying to reconnect with derby client after bringing server down throws SQL Exception 58009 rather than 08XXX exception

    [ https://issues.apache.org/jira/browse/DERBY-3077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12528122 ] 

Kathey Marsden commented on DERBY-3077:
---------------------------------------

Looking at the 58009 exceptions. I think the first 6  should be 08006":
String DRDA_CONNECTION_TERMINATED                               = "58009.C";
    // Use this version of SOCKET_EXCEPTION any time *except* when trying to
    // establish a connection, as the SQLState is different.  When trying
    // to establish a connection, use CONNECT_SOCKET_EXCEPTION.
    String SOCKET_EXCEPTION                                         = "58009.C.2";
    String COMMUNICATION_ERROR                                      = "58009.C.3";
    String CONNECTION_FAILED_ON_DEFERRED_RESET                      = "58009.C.4";
    String NET_INSUFFICIENT_DATA                                    = "58009.C.5";
    String NET_LOB_DATA_TOO_LARGE_FOR_JVM                           = "58009.C.6";


The following would remain 58009 as they are DRDA protocol exceptions:


    String NET_SQLCDTA_INVALID_FOR_RDBCOLID                         = "58009.C.7";
    String NET_SQLCDTA_INVALID_FOR_PKGID                            = "58009.C.8";
    String NET_PGNAMCSN_INVALID_AT_SQLAM                            = "58009.C.9";
    String NET_VCM_VCS_LENGTHS_INVALID                              = "58009.C.10";
    String NET_ENCODING_NOT_SUPPORTED                               = "58009.C.11";
    String NET_NOT_EXPECTED_CODEPOINT                               = "58009.C.12";
    String NET_DDM_COLLECTION_TOO_SMALL                             = "58009.C.13";
    String NET_COLLECTION_STACK_NOT_EMPTY                           = "58009.C.14";
    String NET_DSS_NOT_ZERO                                         = "58009.C.15";
    String NET_DSS_CHAINED_WITH_SAME_ID                             = "58009.C.16";
    String NET_PREMATURE_EOS_DISCONNECT                             = "58009.C.17";
    String NET_INVALID_FDOCA_ID                                     = "58009.C.18";
    String NET_SECTKN_NOT_RETURNED                                  = "58009.C.19";
    String NET_NVCM_NVCS_BOTH_NON_NULL                              = "58009.C.20";
    String NET_SQLCDTA_INVALID_FOR_RDBNAM                           = "58009.C.21";


Does that sound correct?


> Trying to reconnect with derby client after bringing server down throws SQL Exception 58009 rather than 08XXX exception
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3077
>                 URL: https://issues.apache.org/jira/browse/DERBY-3077
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.2.2.0
>            Reporter: Kathey Marsden
>            Assignee: Kathey Marsden
>
> This issue was discussed in DERBY-401, because the case where the server is brought down and an application tries to reconnect does not throw a SQLNonTransientException.  Discussion is still underway about whether 58XXX exceptions should be SQLNonTransientExceptions, but at least for this case changing the exception to 08006 per Knut's suggestion should correct the problem for this case. See https://issues.apache.org/jira/browse/DERBY-401#action_12527400
> Below is current stack and test case.
> Apache Derby
> got connection now sleep
> now try to use the connection after you killed the nS
> Exception in thread "main" java.sql.SQLException: A communications error has been detected: Software caused connection abort: recv failed.
> at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
> at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
> at org.apache.derby.client.am.Connection.prepareStatement(Unknown Source)
> at org.apache.derby.client.am.LogicalConnection.prepareStatement(Unknown Source)
> at DerbyClientNonXA.main(DerbyClientNonXA.java:48)
> Caused by: org.apache.derby.client.am.DisconnectException: A communications error has been detected: Software caused connection abort: recv failed.
> at org.apache.derby.client.net.NetAgent.throwCommunicationsFailure(Unknown Source)
> at org.apache.derby.client.net.Reply.fill(Unknown Source)
> at org.apache.derby.client.net.Reply.ensureALayerDataInBuffer(Unknown Source)
> at org.apache.derby.client.net.Reply.readDssHeader(Unknown Source)
> at org.apache.derby.client.net.Reply.startSameIdChainParse(Unknown Source)
> at org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(Unknown Source)
> at org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(Unknown Source)
> at org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(Unknown Source)
> at org.apache.derby.client.am.Statement.readPrepareDescribeOutput(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.readPrepareDescribeInputOutput(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowPrepareDescribeInputOutput(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.prepare(Unknown Source)
> at org.apache.derby.client.am.Connection.prepareStatementX(Unknown Source)
> ... 3 more
> Caused by: java.net.SocketException: Software caused connection abort: recv failed
> at java.net.SocketInputStream.read(SocketInputStream.java:129)
> ... 15 more
> import java.sql.Connection;
> import java.sql.DatabaseMetaData;
> import java.sql.PreparedStatement;
> import java.sql.SQLException;
> import java.sql.Statement;
> import javax.sql.PooledConnection;
> public class DerbyClientNonXA
> {
> public static void main(String args[]) throws Exception
> {
> org.apache.derby.jdbc.ClientConnectionPoolDataSource40 ds = new org.apache.derby.jdbc.ClientConnectionPoolDataSource40();
> Connection conn = null;
> ds.setDatabaseName("e:\\temp\\sampl127;create=true");
> PooledConnection pooledCon = ds.getPooledConnection();
> conn = pooledCon.getConnection();
> DatabaseMetaData md = conn.getMetaData();
> System.out.println(md.getDatabaseProductVersion());
> System.out.println(md.getDatabaseProductName());
> System.out.println("got connection now sleep. Bring down network server.");
> Statement st = null;
> PreparedStatement ps1 = null;
> st = conn.createStatement();
> try
> {
> st.executeUpdate("drop table TAB1");
> }
> catch (SQLException x)
> {
> System.out.println("no table exists");
> }
> Thread.sleep(15000);
> System.out.println("now try to use the connection after you killed the nS");
> ps1 = conn.prepareStatement("CREATE TABLE TAB1(COL1 INT NOT NULL)");
> ps1.executeUpdate();
> conn.commit();
> System.out.println("done");
> }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.