[Pljava-dev] pljava reninitializing jdbc connection pool for every invocation

From: thomas at tada(dot)se (Thomas Hallgren)
To:
Subject: [Pljava-dev] pljava reninitializing jdbc connection pool for every invocation
Date: 2006-03-21 18:37:24
Message-ID: 442047E4.2020707@tada.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Sriram Dandapani wrote:
> Ok..the picture is getting clearer.. This is what we do
>
> The java method that is called using pljava obtains a jdbc connection
> using the postgresql driver because we need the autonomous transaction
> feature.
>
> When a postgres function calls this pljava function, every invocation
> results in a new connection being obtained. Since we do not use
> pljava.jar to obtain this connection, am I losing out on the nice
> in-process features you mentioned.
>
>

Well, you can never have autonomous transactions in-process when you use
PostgreSQL. But there's no need for you to create a new remote
connection for each and every invocation. Let it be created in your
first call. Store it in a static variable and reuse it on all subsequent
calls. Make sure each call performs a commit or rollback on it but don't
close it.

Regards,
Thomas Hallgren

Browse pljava-dev by date

  From Date Subject
Next Message Sriram Dandapani 2006-03-22 01:28:12 [Pljava-dev] pljava causes postgres to consume excessive memory
Previous Message Thomas Hallgren 2006-03-21 18:19:24 [Pljava-dev] pljava reninitializing jdbc connection pool for every invocation