agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
[Pljava-dev] closing jdbc connections within pljava calls
2+ messages / 0 participants
[nested] [flat]

* [Pljava-dev] closing jdbc connections within pljava calls
@ 2006-04-11 19:43 
  2006-04-11 20:30 ` [Pljava-dev] closing jdbc connections within pljava calls 
  0 siblings, 1 reply; 2+ messages in thread

From:  @ 2006-04-11 19:43 UTC (permalink / raw)

Hi

 

I am implementing autonomous transactions by making a pljava call...and
within the java function, I obtain a jdbc connection using the
postgresql driver.

During a regular plpgsql function call, several calls are made to this
java function.

 

Should I close the jdbc connection when the plgsql function
terminates..or does the fact that the jvm is terminated sufficient ?
What is the impact of not closing the jdbc connection ? The reason I ask
is because an error could cause the plpsql function to terminate
abnormally.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20060411/dd7bdb16/attachment.html;



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* [Pljava-dev] closing jdbc connections within pljava calls
  2006-04-11 19:43 [Pljava-dev] closing jdbc connections within pljava calls 
@ 2006-04-11 20:30 ` 
  0 siblings, 0 replies; 2+ messages in thread

From:  @ 2006-04-11 20:30 UTC (permalink / raw)

Hi Sriram,
The JVM will not terminate until your session terminates and the fact 
that the connection remains opened will be harmless. You will waste 
resources at worst since the backend process that sits at the end of 
that connection remains alive until the connection is closed. My guess 
is that this "waste" is a good thing since you don't need to reestablish 
the connection in case you call your plpgsql function repeatedly.

I'm not 100% sure what happens to the backend process at the other end 
of your connection when the JVM terminates. My guess is that it will 
terminate gracefully when it senses that the socket is closed. But you 
will not have a transaction active when that happens anyway so it 
shouldn't matter much.

Regards,
Thomas Hallgren



Sriram Dandapani wrote:
>
> Hi
>
> I am implementing autonomous transactions by making a pljava call?and 
> within the java function, I obtain a jdbc connection using the 
> postgresql driver.
>
> During a regular plpgsql function call, several calls are made to this 
> java function.
>
> Should I close the jdbc connection when the plgsql function 
> terminates..or does the fact that the jvm is terminated sufficient ? 
> What is the impact of not closing the jdbc connection ? The reason I 
> ask is because an error could cause the plpsql function to terminate 
> abnormally.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at gborg.postgresql.org
> http://gborg.postgresql.org/mailman/listinfo/pljava-dev
>   





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2006-04-11 20:30 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-04-11 19:43 [Pljava-dev] closing jdbc connections within pljava calls 
2006-04-11 20:30 ` 

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox