To Close or not to Close the Trigger's Connection.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

To Close or not to Close the Trigger's Connection.

Tmo_hsqldb_q
I have the following Trigger, it's associated Procedure, and it's associated Java code:


CREATE TRIGGER SOURCE_EVENT_TRIG AFTER INSERT ON SOURCE_EVENT
referencing NEW ROW AS newrow
FOR EACH ROW WHEN (newrow.messageid IS NOT NULL)
CALL sourceEventUpdate(newrow.MessageID);



CREATE PROCEDURE sourceEventUpdate(messageID char(36))
MODIFIES SQL DATA
LANGUAGE JAVA
EXTERNAL NAME 'CLASSPATH:com.bgcp.mule.mrc.SourceEventTrigger.sourceEventUpdate'



public static void sourceEventUpdate(Connection triggerConn,String messageID)
{
...
...

//Should the code be calling close on the connection after it finished using it?
//triggerConn.close()

}


The Java method sourceEventUpdate gets passed to it a Trigger Connection by the internal HSQLDB code.  Should the java code be calling close on the connection after it is finished using it, or should it do nothing and let the internal HSQLDB code manage it?  This table currently gets inserted into a lot.  about 9000 inserts in a minute.


thanks,
Tony

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: To Close or not to Close the Trigger's Connection.

Fred Toussi-2
You don't need to close the internal connection because the close()
method is a no-op in this case.

Each session reuses its own internal connection object.

Fred

On Wed, Jul 31, 2013, at 16:28, Tmo_hsqldb_q wrote:

> I have the following Trigger, it's associated Procedure, and it's
> associated
> Java code:
>
>
> CREATE TRIGGER SOURCE_EVENT_TRIG AFTER INSERT ON SOURCE_EVENT
> referencing NEW ROW AS newrow
> FOR EACH ROW WHEN (newrow.messageid IS NOT NULL)
> CALL sourceEventUpdate(newrow.MessageID);
>
>
>
> CREATE PROCEDURE sourceEventUpdate(messageID char(36))
> MODIFIES SQL DATA
> LANGUAGE JAVA
> EXTERNAL NAME
> 'CLASSPATH:com.bgcp.mule.mrc.SourceEventTrigger.sourceEventUpdate'
>
>
>
> public static void sourceEventUpdate(Connection triggerConn,String
> messageID)
> {
> ...
> ...
>
> //Should the code be calling close on the connection after it finished
> using
> it?
> //triggerConn.close()
>
> }
>
>
> The Java method sourceEventUpdate gets passed to it a Trigger Connection
> by
> the internal HSQLDB code.  Should the java code be calling close on the
> connection after it is finished using it, or should it do nothing and let
> the internal HSQLDB code manage it?  This table currently gets inserted
> into
> a lot.  about 9000 inserts in a minute.
>
>
> thanks,
> Tony
>
>
>
>
>
> --
> View this message in context:
> http://hsqldb.10974.n7.nabble.com/To-Close-or-not-to-Close-the-Trigger-s-Connection-tp3933.html
> Sent from the HSQLDB - User mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Get your SQL database under version control now!
> Version control is standard for application code, but databases havent
> caught up. So what steps can you take to put your SQL databases under
> version control? Why should you start doing it? Read more to find out.
> http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
> _______________________________________________
> Hsqldb-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/hsqldb-user

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
Loading...