To use PostgreSQL as the persistence layer with WebObjects, you need the PostgreSQL JDBC driver and the PostgresqlPlugIn framework from Project Wonder.
A JDBC driver is required for WebObjects, just like for any Java application that talks to a database. You should download the driver that matches the version of PostgreSQL that you have installed from PostgreSQL's JDBC driver download page.
There are several ways to install the driver:
- Put the JAR in the JRE's extensions directory:
/Library/Java/Extensionson Mac OS X, or
$JAVA_HOME/lib/exton Unix. (Be aware that putting JARs in the extensions directory carries caveats with respect to classpath references and versioning. It is loaded by the system classloader and is a global version for all of your Java applications.)
- Put the JAR in the
Librariesdirectory of a specific application.
- Create a framework containing the JAR in
Libraries, and then reference that framework from your applications.
JDBC driver adjusts timestamps
Note that the PostgreSQL JDBC driver will adjust timestamps handed to it by WebObjects into the local timezone of the machine running the JDBC driver. This will occur regardless of whether the database server was started up in UTC (by supplying
postgresql.conf, or as a command line option). This also appears to occur regardless of whether the column type in use is
TIMESTAMP WITHOUT TIME ZONE (which is the type used by the
dateTime prototype), or
TIMESTAMP WITH TIME ZONE. There are several workarounds:
- Obviously if machine-local time is UTC, the problem is non-existent.
- Pass the option
-Duser.timezone=UTCto the JVM at application launch.
- Have a static block in the application's
Applicationclass (or some superclass) that sets the Java default timezone:
This framework is a plugin for the WebObjects
JDBCAdaptor so that it is able to communicate with a PostgreSQL database server. The easiest way to get the
PostgresPlugin.framework is to install Project Wonder. Otherwise, you can download the built frameworks from the mDimension Hudson build server (either Wonder53 or Wonder54), extract the
PostgresqlPlugIn.framework, and place it in
~/Library/Frameworks. You must add the
PostgresPlugin.framework to your application's build path so that it is able to find the plugin.
Using PostgreSQL in Entity Modeler (WOLips)