Daniel John Debrunner wrote:
>Kathey Marsden wrote:
>
>
>
>>Deepa Remesh wrote:
>>
>>
>
>
>
>>>I am doing the following. In network server, check if a null
>>>connection is returned by InternalDriver. If so, throw "new
>>>SQLException("No suitable driver","08001");" to match behaviour with
>>>embedded driver. The server will use this SQLException to build
>>>RDBAFLRM and SQLCARD and send it to client.
>>>
>>>When using embedded driver, this exception gets thrown by
>>>DriverManager.getConnection method.
>>>
>>>
>>>
>>>
>>Hi Deepa,
>>
>>That sounds like the correct approach except that we need to localize
>>the message.
>>Since this message comes from the server message file instead of the
>>network server message file, I think we need to use one of the
>>org.apache.derby.impl.jdbc.Util.generateCsSQLException methods.
>>
>>
>
>Is that correct? The error is being thrown by the network server as
>Deepa describes, not the embedded engine. The embedded driver is
>correctly returning null here, it's the network server that needs to
>handle the null.
>
>
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.
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 alternate
method is to go back to expecting the client itself to reject any
unacceptable urls. Regardless, probably the localization is not
important because the error would never get to the user.
Kathey