Thursday, June 21, 2012 9:35:05 PM
Here we give an example of SQL in PL/Java
. The first one shows how a function can perform a simple query based on a primary key and return the results. The next example shows how the JDBC driver can be used to connect to external PostgreSQL
database instances; or the same one for semi–autonomous transactions. The final example shows how the Oracle JDBC driver
can be used to achieve the same thing.
This final example can be extremely useful when Postgres is run on a system for which there is no native driver for Oracle
and hence the PostgreSQL Foreign Data Wrapper for Oracle
is unlikely to work. People running Postgres on FreeBSD
may benefit from this.
While knowledge of PostgreSQL and PL/Java is assumed, the installation instructions and the provided script should help novices to get started.
The examples are PostgreSQL licensed
Tuesday, June 5, 2012 3:57:57 AM
There are three different ways to return sets from PL/Java
stored procedures in PostgreSQL
. Here we go through the steps necessary to return a set of the basic types using an Iterator and complex types with the ResultSetProvider interface.
Further information can be found on the PL/Java wiki: Functions Returning Sets
The reader is assumed to be familiar with writing and installing Java stored procedures.
Saturday, December 11, 2010 1:10:21 AM
applications as well as PL/Java itself, whether the Java or C code is pretty straight forward. It does however require some setup. Here we go into the details of the setup and demonstrate debugging of a simple "Hello World!" application with Solaris Studio
This is not a PL/Java tutorial. Some familiarity with it is assumed.Note: This demonstration applies to dbx on Solaris amd64. Using it on ia32 as well as Linux should be identical.
Tuesday, December 7, 2010 6:36:40 PM
Plugging the memory leak in PL/Java
reported in bug 1010712
gives us an opportunity to play with DTrace
Wednesday, October 6, 2010 1:04:51 AM
We have created a catalog for our books to keep tabs on where they are in our many thousands of bookshelves around the house. The books have a name
, an author
and the shelf
where they are located.
Now while we move the books from shelf to another from time to time, a books author never does. We have therefore decided to make the author
column immutable; or immune to updates.
To do this we create a trigger in PL/Java
that makes sure the column doesn't get changed.
This tutorial assumes familiarity with SQL, Java and JDBC.