agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
Subject: [Pljava-dev] Questions about pl/java
Date: Wed, 05 Apr 2006 09:10:26 +0200
Message-ID: <44336D62.3000309@tada.se> (raw)
In-Reply-To: <1d219a6f0604041903k528c7b27pd3f640cb03300390@mail.gmail.com>
References: <1d219a6f0604041903k528c7b27pd3f640cb03300390@mail.gmail.com>

Hi Chris,
Some answers from the 'developers of pl/java' side.


Chris Hoover wrote:
 > Hello,
 >
 > I am new to pl/java and have some basic questions.  But before the
 > questions, a bit about my setup.  We are in the process of migrating all
 > of our databases from 7.3.4 to 8.1.1.  When this is done, we will have
 > all of our database servers on RH AS 4.0 with PG 8.1.1.
 >
If your migration hasn't been done yet, I'd seriously consider using PG 
8.1.3 (the latest release). See:

http://www.postgresql.org/about/news.476
http://www.postgresql.org/about/news.456

 > 3.  Do the developers of pl/java consider it production quality?
 >
Yes, but as with every OSS known that I know of, there's a disclaimer in 
the license agreement (standard BSD) that might be worth reading (the 
upper cased part): http://wiki.tada.se/display/pljava/PLJava+License

 > 4.  Can the pl/java be used to communicate across databases?
 >
Yes. PL/Java is particularly well suited for this since you can register 
listeners that get notified when a transaction commits or rolls back. 
The Java runtime, with it's extensive Socket I/O capabilities, is an 
excellent platform to build this kind of things on.

 > 5.  How different is writing in pl/java versus writing application/web
 > java programs?
 >
Well, Java is Java. PL/Java is no different in that respect. There are 
two major things to consider when implementing code for PL/Java:
1. PL/Java code is executed "inside" of transaction, i.e. no commit nor 
rollback available.
2. Code is isolated to one single session, i.e. you can never share data 
with other sessions.

 > 6.  Are the any limitations or major pluses on what pl/java can do
 > versus pl/pgsql?
 >
## The major pluses: ##

** Base your code on the Java Runtime packages
The Java runtime includes XML-parsers, Networking, Collections, Logging, 
and a lot of other things that make life easy for a programmer.

** Use Open Source libraries in your code
If you lack something in hte Java Runtime, chances are high you'll find 
it in an Open Source product that can be downloaded and installed.

** Develop the code using your favorite IDE
Very advanced (and free) Interactive Development Environments

** Source line debugging
Attach to a PL/Java enabled session using the standard java debugger or 
the more advanced debugger that comes with your IDE.

** Managed complexity
Divide your code into classes, interfaces, packages, and different 
projects. Create extensive and complex logic.

** Code Reuse
Reuse utility classes that is used in other parts or your application

** Compatibility
The code that you write will be very easy to port to other databases 
that support Java stored procedures, functions, and triggers.

** All other advantages using a OO language



## Limitations: ##

** Resource demanding
At present, each session that uses PL/Java will instantiate it's own 
JVM. While this has advantages such as very low call overhead and an 
extremely high level of isolation, it has drawbacks such as high memory 
consumption and a long startup time. PL/Java performs best when it is 
used in conjunction with a connection pool. I would not recommend 
PL/Java if you expect a high number of fairly short-lived connections.

I'm working on complementing PL/Java with a solution where all sessions 
share a remote JVM. The call overhead will increase but memory 
consumption and startup times will decrease significantly. I expect both 
types of solutions to be in the product. And no, sorry, no time estimate 
for that.

** Overly complex for very simple tasks
Java code needs to be compiled, packaged in a jar file, and installed 
into the database. pgsql code is embedded in the function declaration.

** Project stability
PL/Java is young, not that widespread, and maintained by a few outside 
of the PostgreSQL core project. PL/pgsql is the opposite on all counts.

 > Thanks so much for any information you can provide me.  I am looking at
 > the documentation, but I am a small time crunch.
 >
Aren't we all ;-)

Kind Regards,
Thomas Hallgren





view thread (4+ messages)  latest in thread

Message-ID: <44336D62.3000309@tada.se>
Permalink:  ../44336D62.3000309@tada.se/
Also on:    postgresql.org/message-id/44336D62.3000309@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] Questions about pl/java
  In-Reply-To: <44336D62.3000309@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