Le 5 oct. 05, à 18:49, Michael J. Segel a écrit :
> On Wednesday 05 October 2005 10:44, Xavier Vigouroux wrote:
>> Le 4 oct. 05, à 23:27, Øystein Grøvlen a écrit :
>>>>>>>> "XV" == Xavier Vigouroux <Xavier-Francois.Vigouroux@Sun.COM>
>>>>>>>> writes:
>>>
>>> XV> Hi,
>>> XV> I have a transient priviledgeException when connection to
>>> the
>>> DB with
>>> XV> ij.
>>>
>>>
>>> XV> here is the scenario:
>>>
>>> XV> 1/ I start an embeddedServer
>>> XV> 2/ wait for the ping() be ok (tested in the JVM creating
>>> the
>>> server)
>>> XV> 3/ start ij to create a schema.
>>>
>>> XV> then in 4, I get a transient error...i.e if I retry it works.
>>>
>>> XV> what should I wait for to be sure the server is ready to
>>> recieve cmd?
>>>
>>> I checked the implementation of ping(), and it seems to only check
>>> that it is able to get in touch with the network server. It does not
>>> try to get a connection to a database. Does anyone have any
>>> suggestion for how Xavier can determine that the server is ready to
>>> create a database?
>>
>> hi,
>>
>> This is really important for me to have a clear condition about the
>> state of the server.
>> making a sleep 10 is not convincing anybody
>>
>> thanks
>>
> Silly me.
>
> You're doing this in a shell script?
yes.
> So when you start derby your command forks a seperate process, hence
> IJ gets
> started prior to the completion of the creation of the base database.
>
no, IJ is creating the DB. and It creates it after the ping() has
returned ok.
> Simple solution.
>
> Write a simple Java App that will in a loop attempt to get a
> connection to the
> database. Once you succeed to get a connection, you exit and then go
> on with
> your script. If you want to be really, really sure, you can always do
> a query
> against something in the SYS schema.
If I understand you, you propose to improve my call to ping with a loop
on the creation (ie. url with create=true) of a *FAKE* schema until it
succeeds.
Then I have to delete all the associated files..... This is what I call
a work-around :-)
The real problem is that the ping() returns before the connection can
be accepted. This is the root problem.
do you agree?
XFV
PS: In my design, there is a big separation between the server and the
user of derby. And the server
indicates it is ready if and only if it is effectively ready....
>
> (Its a Bart Simpson type of app. "Are we there yet?"...)
>
> This should cause enough of a delay that when you run IJ you don't get
> your
> exception.
>
> No?
>
>>> --
>>> Øystein
>
> --
> Michael Segel
> Principal
> MSCC
> (312) 952-8175
>
--
Xavier VIGOUROUX - sun microsystems
|