db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kathey Marsden (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-401) Add SQLException subclasses and throw them correctly to match JDBC 4 spec
Date Thu, 13 Sep 2007 13:22:32 GMT

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

Kathey Marsden commented on DERBY-401:
--------------------------------------

This issue is still marked open so, I am not sure if this is a bug or just unimplemented functionality.
 Using a client connection after bringing network server down does not  throw a NonTransientConnectionException,
but rather just a regular SQLException.  Below is the repro.  Start network server before
you start and shut it down after the sleep message displays.  Below is the trace:

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");

	}
}



> Add SQLException subclasses and throw them correctly to match JDBC 4 spec
> -------------------------------------------------------------------------
>
>                 Key: DERBY-401
>                 URL: https://issues.apache.org/jira/browse/DERBY-401
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.1.1.0
>            Reporter: David Van Couvering
>            Priority: Minor
>
> JDBC4 defines subclasses of SQLException.  Derby code should be upgraded to use these
subclasses and throw them correctly based on the spec.  I recommend we can start work on this
even prior to JDBC 4 spec being finalized.

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


Mime
View raw message