Re: [tcljava-user] Stroing objects in an interpreter
Brought to you by:
mdejong
From: Mo D. <su...@ba...> - 2002-02-10 23:29:10
|
On Sat, 9 Feb 2002 10:56:43 +0100 (CET) "Bas Scheffers" <ba...@sc...> wrote: > Hi, > > Here the scenario: I have a Jacl interpreter running and I created a > commands that executes SQL and gets the results. The cDB connection is > gotten from a PoolMan pool. Now what I would like to do is keep the same > connection during the whole execution of the script so I can use the same > one and do transactions. So I need to store the connection object > somewhere, the most obvious place would be in the Inter object and on the > next call to my database command check if a connection is already available > and reuse it. Is that posible, or does someone have another/better idea? > > Thanks, > Bas. You should be able to just set a Tcl global variable with a wrapped Java object and then use it in your code from that point on. If you are doing this from Tcl code just use java::new or java::call. If you want to do it from Java code you will want to make use of the RefletObject.newInstance() method and the Interp.setVar() method. cheers Mo |