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 Xavier Vigouroux <Xa...@Sun.COM> on 2005/10/03 18:17:21 UTC

transient priviledgeException

Hi,

I have a transient priviledgeException when connection to the DB with 
ij.

here is the scenario:

  1/ I start an embeddedServer
  2/ wait for the ping() be ok (tested in the JVM creating the server)
  3/ start ij to create a schema.

then in 4, I get a transient error...i.e if I retry it works.

what should I wait for to be sure the server is ready to recieve cmd?


-- 
Xavier VIGOUROUX - sun microsystems


Re: transient priviledgeException

Posted by "Michael J. Segel" <ms...@segel.com>.
On Thursday 06 October 2005 04:41, Xavier Vigouroux wrote:
[SNIP]
> >
> > 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.
>
Ok...
> The real problem is that the ping() returns before the connection can
> be accepted. This is the root problem.
>
> do you agree?
>
I think that there may be an issue with your design. But I don't know enough 
yet...
(I'm not really keen on IJ. I guess since I'm working with Derby as an 
embedded db, eclipse has a better interface for what I need. ;-)

> 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....
>
Ok....

I'm still a little confused on what you're trying to do...

Something is being lost in translation.

It sounds like you're trying to start a derby database using the NetworkServer 
framework, then once it is up, you want to then create a schema using IJ?

That is you're running IJ only once against a remote database?

And the problem that you run in to is that ping() will say that the network 
listeners are up and running but the actual database may not yet available?

If thats the case then yes, you'd want to write a simple java app to replace 
ping().

No you're not going to create a test schema.

Here's the logic.

In your main() {
	int retcd =0;

	while (retcd ==0) {
		retcd = tryConnection();
	}
}

In your tryConnection() method:

public static int tryConnection(){
	int retcd =0;
	try{ 
		blah blah blah
		Connection con = ...
		retcd = 1;
	}
	Catch (exception e)
	{
		retcd =  0;
	}
	

Well you get the idea.

The point is that if you can get a connection to the database, then you should 
be able to run ij to create the schema.

I was saying that if you *really* want to be *anal*, you could do a secondary 
loop to be sure...

That is to do a query against SYS.SYSSCHEMAS.

If the database is truly up and running, you should be able to get a result 
set. 

But that's being paranoid. 
I believe being able to establish a connection to the database should be 
enough to ensure that its up and running.

So what am I missing? Besides half a bottle of Vodka that was full sometime 
the night before along with any sort of memory of what happend past 9:00 
pm.... ;-)



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

Re: transient priviledgeException

Posted by "Michael J. Segel" <ms...@segel.com>.
On Monday 10 October 2005 08:50, Øystein Grøvlen wrote:
> >>>>> "XV" == Xavier Vigouroux <Xa...@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

Re: transient priviledgeException

Posted by Xavier Vigouroux <Xa...@Sun.COM>.
Le 10 oct. 05, à 15:50, Øystein Grøvlen a écrit :

>>>>>> "XV" == Xavier Vigouroux <Xa...@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.

that's a good point!!! I will try
>
> 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.
>

that would be great indeed !!!

I keep you inform... thanks

> -- 
> Øystein
>
>
-- 
Xavier VIGOUROUX - sun microsystems


Re: transient priviledgeException

Posted by Øystein Grøvlen <Oy...@Sun.COM>.
>>>>> "XV" == Xavier Vigouroux <Xa...@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.

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.

-- 
Øystein


Re: transient priviledgeException

Posted by Xavier Vigouroux <Xa...@Sun.COM>.
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 <Xa...@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


Re: transient priviledgeException

Posted by "Michael J. Segel" <ms...@segel.com>.
On Wednesday 05 October 2005 10:44, Xavier Vigouroux wrote:
> Le 4 oct. 05, à 23:27, Øystein Grøvlen a écrit :
> >>>>>> "XV" == Xavier Vigouroux <Xa...@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?
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.

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.

(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

Re: transient priviledgeException

Posted by Xavier Vigouroux <Xa...@Sun.COM>.
Le 4 oct. 05, à 23:27, Øystein Grøvlen a écrit :

>>>>>> "XV" == Xavier Vigouroux <Xa...@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


>
> -- 
> Øystein
>
>
-- 
Xavier VIGOUROUX - sun microsystems


Re: transient priviledgeException

Posted by Daniel John Debrunner <dj...@debrunners.com>.
Michael J. Segel wrote:


> Uhm silly question. 1 "... start an embeddedServer."
> That would imply that only one connection is allowed.

No, Derby's embedded engine is fully multi-user, multi-threaded,
multi-connection. It's the engine used by the network server.

Dan.



Re: transient priviledgeException

Posted by "Michael J. Segel" <ms...@segel.com>.
On Tuesday 04 October 2005 16:27, Øystein Grøvlen wrote:
> >>>>> "XV" == Xavier Vigouroux <Xa...@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?

Uhm silly question. 1 "... start an embeddedServer."
That would imply that only one connection is allowed.

Do you mean network server?

If so, have you tried to do steps 1 and 2 and instead of using IJ, create the 
schema in a simple java app?

There may be a warning or exception at the time you establish a connection to 
the database.



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

Re: transient priviledgeException

Posted by Øystein Grøvlen <Oy...@Sun.COM>.
>>>>> "XV" == Xavier Vigouroux <Xa...@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?

-- 
Øystein


Re: [generic question] derby and password

Posted by Sunitha Kambhampati <ks...@gmail.com>.
Xavier Vigouroux wrote:

> Hi
>
> In my project, I create a database that is access afterwards.
> at creation, I would like to "secure" the access.
>
> as a dummy question, what is the usual way to secure an access to the DB
> whereas the user is never in the loop. All must be done programmatically?
>
Can you elaborate on what you mean by 'secure' here...

If you want to restrict access to the database with respect to which 
user can connect to derby database, you could turn on  user authentication.

To set user authentication, the property is
derby.connection.requireAuthentication=true

Before this, you would have to set users that can access the database. 
http://db.apache.org/derby/docs/dev/devguide/cdevcsecure21547.html#cdevcsecure21547
 http://db.apache.org/derby/docs/dev/devguide/cdevcsecure36127.html

E.g. for default builtin authentication provided by derby, you would 
have to set the following property  to define a user 'sunitha' with 
password 'pwd'
derby.user.sunitha=pwd

Now to connect to derby, you would have to ensure that the userid, 
password combination is correct and valid , otherwise you will get the 
error 'Connection refused:Invalid authentication'.

$ java org.apache.derby.tools.ij
ij version 10.2
ij> connect 'jdbc:derby:testdb;create=true;user=sunitha;password=pwd';   
     
ij> connect 'jdbc:derby:testdb;create=true;user=sunitha;password=pwd2';
ERROR 08004: Connection refused : Invalid authentication.
ij> connect 'jdbc:derby:testdb;create=true;user=sunitha2;password=pwd2';
ERROR 08004: Connection refused : Invalid authentication.
ij>

HTH,
Sunitha.

Re: [generic question] derby and password

Posted by "Jean T. Anderson" <jt...@bristowhill.com>.
Xavier Vigouroux wrote:
> Hi
> 
> In my project, I create a database that is access afterwards.
> at creation, I would like to "secure" the access.
> 
> as a dummy question, what is the usual way to secure an access to the DB
> whereas the user is never in the loop. All must be done programmatically?

This isn't a dumb question at all -- it's an excellent question for 
Derby because you don't find derby databases in the typical place behind 
a locked door.

Derby has a bunch of strategies. Here's a quick overview to help you 
decide which one might be right for your application.

*Authentication* restricts access to a database (or all databases in a 
system) given a userid and password. Here's an into to authentication: 
http://db.apache.org/derby/docs/dev/devguide/cdevcsecure42374.html .

*Authorization* restricts access to objects in a database -- without a 
user in the loop, you might not need this, but here's info on it: 
http://db.apache.org/derby/docs/dev/devguide/cdevcsecure36595.html . 
Also, DERBY-464 adds grant/revoke, but isn't implemented yet.

*Encryption* lets you secure the physical database files -- it encrypts 
all the data in tables, indexes, temporary files, the transaction log. 
It's great for protecting databases on devices that can't be secured. 
Information is here: 
http://db.apache.org/derby/docs/dev/devguide/cdevcsecure24366.html .

You can also run your application under a Java 2 Security Manager, which 
is especially useful for when you want to allow remote client access 
using the Derby Network Server. Information is here: 
http://db.apache.org/derby/docs/dev/devguide/cdevcbabejdfj.html . 
However, be aware that the sample policy files aren't quite right 
(DERBY-701), so if you run into any problems, feel free to ask for help.

Dan Debrunner did a "Securing Data with Apache Derby" at ApacheCon US 
2004; you can download his presentation from 
http://db.apache.org/derby/papers/ApacheConUs04.html .

I'll be doing a "Apache Derby Security" presentation at ApacheCon US in 
December -- shameless plug.  :-) I'm hoping to see lots of users there.

regards,

-jean


ps. There's also a developerWorks tutorial that shows how to work with 
derby and signed jar files, but I haven't had time to look at it yet: 
http://www.ibm.com/developerworks/edu/os-dw-os-ad-buildapp.html

[generic question] derby and password

Posted by Xavier Vigouroux <Xa...@Sun.COM>.
Hi

In my project, I create a database that is access afterwards.
at creation, I would like to "secure" the access.

as a dummy question, what is the usual way to secure an access to the DB
whereas the user is never in the loop. All must be done 
programmatically?

is there a "challenge code"?

I am really a dummy in this area...

thanks


Re: transient priviledgeException

Posted by "Michael J. Segel" <ms...@segel.com>.
On Tuesday 11 October 2005 01:56, Xavier Vigouroux wrote:
> Le 10 oct. 05, à 19:05, Kathey Marsden a écrit :
> > Xavier Vigouroux wrote:
> >> Hi,
> >>
> >> I have a transient priviledgeException when connection to the DB with
> >> ij.
> >>
> >> here is the scenario:
> >>
> >>  1/ I start an embeddedServer
> >>  2/ wait for the ping() be ok (tested in the JVM creating the server)
> >>  3/ start ij to create a schema.
> >>
> >> then in 4, I get a transient error...i.e if I retry it works.
> >>
> >> what should I wait for to be sure the server is ready to recieve cmd?
> >
> > I have not been following this thread closely, and perhaps this has
> > been
> > covered, but I was wondering  what is step  4 doing and what is the
> > error  and what is the transient error and stack trace that you get?
>
> in fact step 4 is step 3 (I did an error):  and starting to create a
> schema means
> ooening a connection with "create=true".
>
Ok,

But that shouldn't cause an error or even throw an exception.

If the database already exists and you open a connection to that database with 
CREATE=TRUE, then you will only get a warning message. And that isn't even 
thrown. 

Well, maybe I shouldn't say that..... There could be a bug ...

I'm working with Derby using the embedded framework and in my application, I 
have a -init command line option.  Here I open the connection with 
CREATE=TRUE and then check the warnings. If I get a warning, then I know the 
database already exists in some state. I then go to the SYS.SYSTABLE (joined 
with the SYS.SYSSCHEMA table) to get all the existing tables in the schema 
and then drop them. (Then the schema too). After this clean up, I call my 
initDB method that creates the schema and tables.

This works for me, although I'm doing this within a java program and not a 
shell script.


> concerning the stack, the execption is is the call to openConnection
>

OK, 
If you try my little program, it should solve this.



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

Re: transient priviledgeException

Posted by Xavier Vigouroux <Xa...@Sun.COM>.
Le 10 oct. 05, à 19:05, Kathey Marsden a écrit :

> Xavier Vigouroux wrote:
>
>> Hi,
>>
>> I have a transient priviledgeException when connection to the DB with 
>> ij.
>>
>> here is the scenario:
>>
>>  1/ I start an embeddedServer
>>  2/ wait for the ping() be ok (tested in the JVM creating the server)
>>  3/ start ij to create a schema.
>>
>> then in 4, I get a transient error...i.e if I retry it works.
>>
>> what should I wait for to be sure the server is ready to recieve cmd?
>>
>
> I have not been following this thread closely, and perhaps this has 
> been
> covered, but I was wondering  what is step  4 doing and what is the
> error  and what is the transient error and stack trace that you get?
>

in fact step 4 is step 3 (I did an error):  and starting to create a 
schema means
ooening a connection with "create=true".

concerning the stack, the execption is is the call to openConnection

regards

> Thanks
>
> Kathey
>
>
-- 
Xavier VIGOUROUX - sun microsystems


Re: transient priviledgeException

Posted by Xavier Vigouroux <Xa...@Sun.COM>.
Hi,

I come back to you concerning the problem described below (ie. 
priviledgException with ij).
I implemented the solution below below (i.e testing the server with a 
fake connection).

the result is that I still have the priviledge exception.....thus it 
must come from something else..

here is the ij line I execute:

java -Dij.driver=org......ClientDriver
      -Dij.user=XXXXXX
      -Dij.password=YYYYYY
      -Dij.database="${URL};create=true"
      org.apache.derby.tools.ij ${SQL}

maybe the problem comes from this line.....



Le 11 oct. 05, à 17:49, Michael J. Segel a écrit :

> On Tuesday 11 October 2005 02:06, Xavier Vigouroux wrote:
>> Let's summarize
>>
>> 1/ I start the embedded server and wait ping is ok
>> 2/ I execute "ij" to boot the DB and create the schema (ij.database 
>> has
>> a create=true)
>>     and I give an SQL file to execute.
>>
>> at the first line of the execution (some kind of open) , I have a
>> priviledgeException
>>
>
> Ok,
>
> In step one, I'm making the assumption that you're using the 
> NetworkServer
> framework.
> (I say this because I'm using Derby in an embedded app and I don't 
> have to
> start anything.) This goes back to my question about the use of the 
> term
> "embedded server"....
>
> In step 1, you are also using ping() to see if its ok.  I'm going to 
> go out on
> a limb and assume that you mean Net::Ping in a Perl Script?  Again 
> according
> to the man page it doesn't attempt to understand the protocol only 
> that you
> have a live machine and that you can establish a connection to that 
> port.
>
> This goes back to my suggestion of writing a simple java program that 
> in a
> loop will try to establish a connection.
>
> Class foo{
> 	private int getConnection(){
> 		int retcd = 1;
> 		try{
> 			// Since I don't know what you
> 			// are trying to do, I'm going to
> 			// assume that you know how to write
> 			// this in java.
> 			blah, blah, blah
> 			// Open the connection
> 			return retcd;
> 		}
> 		catch (Exception e){
> 			// doesn't matter if anything is thrown
> 			// You can print the exception
> 			retcd = 0;
> 			return retcd;
>                 }
>          }
>
> 	public void main(){
> 		int retcd = 0; //
> 		while (retcd == 1){
> 			retcd = getConnection();
> 		}
> 	}
> }
>
> Ok some notes:
> 1) Since I don't know your app, I'm going to assume that you've either
> hardcoded certain properties, or if you're doing this in a shellscript 
> or
> perl script, you can write those properties to a file.
>
> This is why I don't have enough information to give you more detail on 
> how to
> write a connection.
>
>
> 2) This is a really, really simple thing to write.
> In the main, all you are doing is looping until you get a good 
> connection.
> Note that I should have used a finally block to return the retcd. But 
> hey, I'm
> being lazy and in this example, its more obvious at what I want to do. 
> ;-)
>
> 3) I'm old school. This is why the main method is at the end of the 
> class def.
> 		
> Does this make sense?
>
> -- 
> Michael Segel
> Principal
> MSCC
> (312) 952-8175
>
-- 
Xavier VIGOUROUX - sun microsystems


Re: transient priviledgeException

Posted by "Michael J. Segel" <ms...@segel.com>.
On Tuesday 11 October 2005 02:06, Xavier Vigouroux wrote:
> Let's summarize
>
> 1/ I start the embedded server and wait ping is ok
> 2/ I execute "ij" to boot the DB and create the schema (ij.database has
> a create=true)
>     and I give an SQL file to execute.
>
> at the first line of the execution (some kind of open) , I have a
> priviledgeException
>

Ok,

In step one, I'm making the assumption that you're using the NetworkServer 
framework.
(I say this because I'm using Derby in an embedded app and I don't have to 
start anything.) This goes back to my question about the use of the term 
"embedded server"....

In step 1, you are also using ping() to see if its ok.  I'm going to go out on 
a limb and assume that you mean Net::Ping in a Perl Script?  Again according 
to the man page it doesn't attempt to understand the protocol only that you 
have a live machine and that you can establish a connection to that port.

This goes back to my suggestion of writing a simple java program that in a 
loop will try to establish a connection.

Class foo{
	private int getConnection(){
		int retcd = 1; 
		try{
			// Since I don't know what you
			// are trying to do, I'm going to 
			// assume that you know how to write
			// this in java.
			blah, blah, blah
			// Open the connection
			return retcd;
		}
		catch (Exception e){
			// doesn't matter if anything is thrown
			// You can print the exception
			retcd = 0;
			return retcd;
                }
         }

	public void main(){
		int retcd = 0; // 
		while (retcd == 1){
			retcd = getConnection();
		}
	}
}

Ok some notes:
1) Since I don't know your app, I'm going to assume that you've either 
hardcoded certain properties, or if you're doing this in a shellscript or 
perl script, you can write those properties to a file. 

This is why I don't have enough information to give you more detail on how to 
write a connection. 


2) This is a really, really simple thing to write. 
In the main, all you are doing is looping until you get a good connection.
Note that I should have used a finally block to return the retcd. But hey, I'm 
being lazy and in this example, its more obvious at what I want to do. ;-)

3) I'm old school. This is why the main method is at the end of the class def.
		
Does this make sense?

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

Re: transient priviledgeException

Posted by Xavier Vigouroux <Xa...@Sun.COM>.
Let's summarize

1/ I start the embedded server and wait ping is ok
2/ I execute "ij" to boot the DB and create the schema (ij.database has 
a create=true)
    and I give an SQL file to execute.

at the first line of the execution (some kind of open) , I have a 
priviledgeException


Le 10 oct. 05, à 19:05, Kathey Marsden a écrit :

> Xavier Vigouroux wrote:
>
>> Hi,
>>
>> I have a transient priviledgeException when connection to the DB with 
>> ij.
>>
>> here is the scenario:
>>
>>  1/ I start an embeddedServer
>>  2/ wait for the ping() be ok (tested in the JVM creating the server)
>>  3/ start ij to create a schema.
>>
>> then in 4, I get a transient error...i.e if I retry it works.
>>
>> what should I wait for to be sure the server is ready to recieve cmd?
>>
>
> I have not been following this thread closely, and perhaps this has 
> been
> covered, but I was wondering  what is step  4 doing and what is the
> error  and what is the transient error and stack trace that you get?
>
> Thanks
>
> Kathey
>
>
-- 
Xavier VIGOUROUX - sun microsystems


Re: transient priviledgeException

Posted by Kathey Marsden <km...@sbcglobal.net>.
Xavier Vigouroux wrote:

> Hi,
>
> I have a transient priviledgeException when connection to the DB with ij.
>
> here is the scenario:
>
>  1/ I start an embeddedServer
>  2/ wait for the ping() be ok (tested in the JVM creating the server)
>  3/ start ij to create a schema.
>
> then in 4, I get a transient error...i.e if I retry it works.
>
> what should I wait for to be sure the server is ready to recieve cmd?
>

I have not been following this thread closely, and perhaps this has been
covered, but I was wondering  what is step  4 doing and what is the
error  and what is the transient error and stack trace that you get?

Thanks

Kathey