db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepa Remesh <drem...@gmail.com>
Subject Re: [jira] Updated: (DERBY-374) Invalid URL with Derby Client when connecting to Network Server causes protocol exception.
Date Thu, 22 Sep 2005 19:53:03 GMT
On 9/21/05, Kathey Marsden <kmarsdenderby@sbcglobal.net> wrote:

> Yes, I think the idea is that  network server handle the null by
> constructing this SQLException to return to the client for the failed
> connection which the client could use to determine the problem and
> behave appropriately.
> In general for any failed connection
>     Client Sends  ACCRDB
>     Server tries to connect  and  gets null from driver.connect() or
> other exception.
>     Server sends   RDBAFLRM and appropriate SQLCARD  (SQLException)
> For the case where driver.connect() returns null on the server side  we
> have to  return an SQLCARD with the RDBAFLRM  that the  client can use
> and  differentiate this special kind of error so it can return null from
> its own connect() method.

I have changed the ClientDriver to look for the specific exception
returned from Network Server for null connection. If it gets this
exception, it inturn returns null to the caller.

>  Thinking about it a bit more, perhaps an RDBAFLRM and a  null SQLCARD
> would work for that purpose instead of constructing an SQLException to
> send with the RDBAFLRM and maybe makes more sense here.

The protocol requires a RDBAFLRM to be followed by a SQLCARD. A
SQLCARD with null SQLException is being returned at many places by the
server and so I think this cannot be used here. I could not find a
specific message type in the protocol to return information about null

>  The alternate
> method is to go back to expecting the client itself to reject any
> unacceptable urls.

Since network server gives NPE with certain URLs, I think this has to
be solved on the server side.

>Regardless,  probably  the localization is not
> important because the error would never get to the user.

With checks added to ClientDriver, the error will not get to the user.

Please see if these changes are okay. I will post a patch after tests complete.

1. Network server checks for null connections returned by
InternalDriver and throws a specific exception. It sends back RDBAFLRM
and SQLCARD with this exception.

//In org.apache.derby.impl.drda.Database.makeConnection(Properties)
if(conn == null){
	throw new SQLException("No suitable driver","08001");

2. ClientDriver.connect checks for this exception and returns null.

        	conn =
new org.apache.derby.client.net.NetConnection((org.apache.derby.client.net.NetLogWriter)
        catch(java.sql.SQLException e){
        	if(e.getMessage().indexOf("No suitable driver") != -1){
        		//No suitable driver exception means a null connection was
        		//returned to Network server by InternalDriver
        		conn = null;
        		throw e;

      return conn;


View raw message