db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@debrunners.com>
Subject Re: Database shutdown
Date Fri, 13 May 2005 02:47:47 GMT
Suresh Thalamati wrote:

>  Shutdown in derby throws
> exception,  you  may want to check
> the error codes to make sure the system is being properly shutdown.
> 
> ij> connect 'jdbc:derby:wombat;shutdown=true';
> ERROR 08006: Database 'wombat' shutdown.
> ij> connect 'jdbc:derby:;shutdown=true';
> ERROR XJ015: Derby system shutdown.
> 

> Piet Blok wrote:
>>        shutdownProperties.put("shutdown", "true");
>>        try {
>>            driver.connect("jdbc:derby:", shutdownProperties);
>>        } catch (SQLException e) {
>>            if (e.getErrorCode() == 50000) {
>>                System.out.println(e.getLocalizedMessage());

I would highly recommend checking the SQL State, not the error code. The
state is what Suresh actually showed in his e-mail, 08006 and XJ015.

I don't think the return values from getErrorCode() for Derby are
specified in the public api and should not be relied on.

Code would be something like

catch (SQLEception sqle)
{
    if ("08006".equals(sqle.getSQLState())
         <do nothing> ; // ok database shutdown
    else
         <display error>; // exception on shutdown
}

Dan.



Mime
View raw message