[EMAIL PROTECTED] wrote:
> Hi Deepa,
>
> Thanks a lot for your help. That worked like a charm.
>
> So I have now changed my code to this:
>
> ((EmbeddedDataSource)ds).setShutdownDatabase("shutdown");
> ((EmbeddedDataSource)ds).getConnection();
Just a couple of warnings with this code:
1) This affects the datasource for every application or thread that
is using it.
2) Some J2EE app servers will wrap the database's DataSource
implementation in their own, meaning the cases will fail.
Another way is to have another Derby data source setup in the
configuration that has the shutdownDatabase property set to "shutdown".
Then you would do:
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)
envCtx.lookup("jdbc/EmployeeDB_shutdown");
try {
ds.getConnection();
} catch (SQLExcepion sqle) {
}
Dan.