From: thomas at tada.se (Thomas Hallgren) Date: Tue, 11 Apr 2006 22:30:18 +0200 Subject: [Pljava-dev] closing jdbc connections within pljava calls In-Reply-To: <6992E470F12A444BB787B5C937B9D4DF03EF4586@ca-mail1.cis.local> References: <6992E470F12A444BB787B5C937B9D4DF03EF4586@ca-mail1.cis.local> Message-ID: <443C11DA.6070502@tada.se> 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 >