db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael J. Segel" <mse...@segel.com>
Subject Re: transient priviledgeException
Date Mon, 10 Oct 2005 14:27:27 GMT
On Monday 10 October 2005 08:50, Øystein Grøvlen wrote:
> >>>>> "XV" == Xavier Vigouroux <Xavier-Francois.Vigouroux@Sun.COM>
writes:
>
>     XV> If I  understand you, you  propose to improve  my call to ping 
> with a XV> loop on  the creation  (ie. url with  create=true) of a  *FAKE*
> schema XV> until it succeeds.
>
>
>     XV> Then I  have to delete  all the associated  files..... This is 
> what I XV> call a work-around :-)
>
> Xavier,
>
> What if you try to connect to a non-existing database without
> 'create=true'?  In that case, no files will be created.  I have not
> tried this out myself, but maybe you will be able to observe a
> different behavior when the db is ready to create a database.  E.g,
> you get priviledgeException if not yet ready and "Database not found"
> when it is ready.  In that case you will be able to loop without
> having to clean up any files.
>
No you don't have to do that.

If you attempt to create a connection, the connection will either throw an 
exception, or it will actually connect to the database. 

I believe that ping(), as per an earlier e-mail in this thread, just checks to 
see if there is something listening to the port and doesn't actually make the 
connection.

My suggestion is to in a loop, try to establish a connection. Returning true 
and exiting the loop once a connection has been made.

This should work.

Now if you try and create a database that already exists, nothing gets thrown. 
You have to check the SQLWarnings to see if there was a warning message. 

> Another alternative could be to try do this in the server VM instead
> of/in addition to ping().  If you are lucky, your getConnection will
> in that case not return until it is possible to create a database.

-- 
Michael Segel
Principal
MSCC
(312) 952-8175

Mime
View raw message