[Pljava-dev] closing jdbc connections within pljava calls

From: thomas at tada(dot)se (Thomas Hallgren)
To:
Subject: [Pljava-dev] closing jdbc connections within pljava calls
Date: 2006-04-11 20:30:18
Message-ID: 443C11DA.6070502@tada.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

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
>

In response to

Browse pljava-dev by date

  From Date Subject
Next Message Marek Lewczuk 2006-04-12 06:08:15 [Pljava-dev] out of memory
Previous Message Sriram Dandapani 2006-04-11 19:43:53 [Pljava-dev] closing jdbc connections within pljava calls