You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Oskar Zinger <os...@yahoo.com> on 2012/11/14 00:27:36 UTC

Re: How to reset Derby Database in JVM

Hi Rick,

Thank you for the pointers to the right places in the documentation.

Here is what I used:
Shutting down the system:
http://db.apache.org/derby/docs/10.8/devguide/tdevdvlp20349.html
Shutting down Derby or an individual database:
http://db.apache.org/derby/docs/10.8/devguide/tdevdvlp40464.html

I am using Derby Network Server... and I think it would have helped if the
documentation mentioned somewhere that this same approach would work for
Client / Server deployment of Derby. Somehow it seemed to me this would have
only worked for an Embedded deployment of Derby.

Thanks,
Oskar Zinger
 

Rick Hillegas-3 wrote:
> 
> On 10/10/12 6:35 PM, Oskar Zinger wrote:
>> Hi Derby Community,
>>
>> I'm having some difficulties resetting a Derby Database without 
>> restarting the whole application (JVM).
>>
>> I'm deploying Derby Network Server. My application has a service that 
>> executes shutdown / start of the Derby Network Server on demand.
>>
>> // code here to clear Derby connection pool
>> derbyServer.shutdown();
>> derbyServer = null;
>>
>> The above does not reset the Derby database.
> Hi Oskar,
> 
> This may be relevant to the problem you are seeing: When you shutdown 
> the server, that does not shut down any booted databases and it does not 
> shutdown the Derby engine. Instructions for shutting down a single 
> database and the entire engine can be found in the Derby Developer's 
> Guide in the section titled "Shutting down Derby or an individual 
> database": http://db.apache.org/derby/docs/10.9/devguide/
> 
> Hope this helps,
> -Rick
>>
>> For example, what if my database becomes corrupted and I would like to 
>> stop the service, remove the database, and copy over my new template 
>> database (or recreate the database) without having to restart my whole 
>> application. Is this possible?
>>
>> Thanks,
>> Oskar Zinger
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-reset-Derby-Database-in-JVM-tp34541038p34676336.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: How to reset Derby Database in JVM

Posted by Oskar Zinger <os...@yahoo.com>.
Actually, it does work for a Client / Server - the only problem is with
executing the remote shutdown - the SQL State code that is returned is
different from a designated local execution. This happens when the error
return is "database not found" if the database has not been booted yet or
has already been shutdown.

The same issue happens when a successful shutdown occurs - but now the Error
Code is different.

However, in all of this the database does get successfully shutdown.

I have opened an issue for this:
https://issues.apache.org/jira/browse/DERBY-5994

I need to be able to execute this remotely, from the Backup Derby to
shutdown the Primary Derby before starting replication.

Thanks,
Oskar


kmarsden wrote:
> 
> On 11/13/2012 3:27 PM, Oskar Zinger wrote:
>> Hi Rick,
>>
>> Thank you for the pointers to the right places in the documentation.
>>
>> Here is what I used:
>> Shutting down the system:
>> http://db.apache.org/derby/docs/10.8/devguide/tdevdvlp20349.html
>> Shutting down Derby or an individual database:
>> http://db.apache.org/derby/docs/10.8/devguide/tdevdvlp40464.html
>>
>> I am using Derby Network Server... and I think it would have helped if
>> the
>> documentation mentioned somewhere that this same approach would work for
>> Client / Server deployment of Derby. Somehow it seemed to me this would
>> have
>> only worked for an Embedded deployment of Derby.
> I think that it will only work really well for Embedded. Shutting down 
> remotely can lead to protocol errors and also prevent you from getting 
> the nested exception for the SQLException returned because the system is 
> shutdown.
> 
>   If you are using embedded Server I would recommend using the embedded 
> URL if you can.
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-reset-Derby-Database-in-JVM-tp34541038p34676747.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: How to reset Derby Database in JVM

Posted by Katherine Marsden <km...@sbcglobal.net>.
On 11/13/2012 3:27 PM, Oskar Zinger wrote:
> Hi Rick,
>
> Thank you for the pointers to the right places in the documentation.
>
> Here is what I used:
> Shutting down the system:
> http://db.apache.org/derby/docs/10.8/devguide/tdevdvlp20349.html
> Shutting down Derby or an individual database:
> http://db.apache.org/derby/docs/10.8/devguide/tdevdvlp40464.html
>
> I am using Derby Network Server... and I think it would have helped if the
> documentation mentioned somewhere that this same approach would work for
> Client / Server deployment of Derby. Somehow it seemed to me this would have
> only worked for an Embedded deployment of Derby.
I think that it will only work really well for Embedded. Shutting down 
remotely can lead to protocol errors and also prevent you from getting 
the nested exception for the SQLException returned because the system is 
shutdown.

  If you are using embedded Server I would recommend using the embedded 
URL if you can.