agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
Subject: [Pljava-dev] Newbie Questions
Date: Fri, 29 Sep 2006 21:12:00 +0200
Message-ID: <451D7000.70406@tada.se> (raw)
In-Reply-To: <451D6A12.7020604@softhome.net>
References: <451D6A12.7020604@softhome.net>

Scott Petersen wrote:
> Folks,
>
> YES, I am a newbie.  But I have been tasked to verify several questions 
> specific to the PLJava implementation (version 1.3. 0, Postgresql 
> 8.1+).  I have read the manual at 
> http://wiki.tada.se/wiki/display/pljava/The+choice+of+JNI which has been 
> most helpful and informative.  But I need to verify the following:
>
>     1)   When I create a connection "Connection db = 
> DriverManager.getConnection("jdbc:default:connection");", does this 
> reuse/copy/duplicate the existing connection or does it create a new 
> (second) connection to the database?
>
>   
Well, that depends on how you look at it. Let me elaborate:

You start with a client application. If you use Java, you will probably 
use JDBC but the same is true if you use the psql client or something 
else. This application will utilize some kind of IPC mechanism (often a 
socket) and connect your client process to the backend server process. 
The first time the backend server process executes a Java function, it 
will instantiate a JVM. If the Java method in turn uses the 
getConnection() method that you give in your example, it will establish 
an *internal* connection within the backend. Unlike the the socket 
connection, this connection is in-process, has very low overhead, and 
executes within the same transaction as the caller.


>     2)    In reading the above referenced web page it appears that each 
> connection has its own JVM.  Is this true, or is there a single JVM per 
> schema, or a single JVM per database?
>
>   
It's a single JVM per client connection. I recommend reading 
http://wiki.tada.se/wiki/display/pljava/The+choice+of+JNI for a deeper 
understanding of the choice of technology.

Kind Regards,
Thomas Hallgren





view thread (2+ messages)

Message-ID: <451D7000.70406@tada.se>
Permalink:  ../451D7000.70406@tada.se/
Also on:    postgresql.org/message-id/451D7000.70406@tada.se

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pljava-dev@postgresql.org
  Subject: Re: [Pljava-dev] Newbie Questions
  In-Reply-To: <451D7000.70406@tada.se>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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