Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

There are three pieces required to To use PostgreSQL with WO:as the persistence layer with WebObjects, you need the PostgreSQL JDBC driver and the PostgresqlPlugIn framework from Project Wonder.

JDBC Driver

The A JDBC driver is required for WO WebObjects, just like for any Java application that talks to a database. You can should download the JDBC driver for PostgreSQL from http://jdbc.postgresql.org/download.html . Make sure to download the driver that matches the version of PostgreSQL that you have installed .The easiest route for installation is to drop the JDBC jar file into your from PostgreSQL's JDBC driver download page.

There are several ways to install the driver:

  1. Put the JAR in the JRE's extensions directory: /Library/Java/Extensions on Mac OS X, or $JAVA_HOME/lib/ext on Unix. (Be aware that putting

...

  1. JARs in the extensions directory carries caveats with respect to classpath references and versioning

...

  1. . It is loaded by the system classloader and is a global version for all of your Java applications.)
  2. Put the JAR in the Libraries directory of a specific application.
  3. Create a framework containing the JAR in Libraries, and then reference that framework from your applications.

...

PostgresqlPlugin Framework

The easiest way to get the PostgresPlugin.framework is to download one of the nightly builds of Project WOnder from the mDimension nightly build server at http://webobjects.mdimension.com/wonder . Uncompress the tar of the version you need into your /Library/Frameworks folder to install them. You must add the PostgresPlugin.framework to your WOApplication so that it is able to find the plugin.

PostgreSQL EOModeler Bundle

Currently the Wonder build server does not autobuild the piece (coming soon). This is only needed for generating SQL out of EOModeler, so if you're just deploying, this isn't necessary. To use the EOModeler Bundle, checkout Project Wonder from its SourceForge repository (you can just checkout Wonder/PlugIns if you don't want everything). Go into the PostgresPlugInBundle folder and run xcodebuild, or load the project into Xcode and build it from the GUI. This will produce a build/Default/PostgresqlPlugIn.EOMplugin folder that you can copy into your /Developer/EOMBundles folder. Note that you CANNOT put it into your ~/Devloper/EOMBundles folder because EOModeler decides it doesn't want to look in that folder.

Using PostgreSQL in EOModeler

Once you have set everything up, using PostgreSQL in EOModeler is actually very straight-forward. Remember to add the PostgresPlugin.framework to your project, open your model, and Set Adapter Info to:

...

Note
titleJDBC 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 timezone=UTC in 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 ERPrototypes.framework dateTime prototype), or TIMESTAMP WITH TIME ZONE. There are several workarounds:

  1. Obviously if machine-local time is UTC, the problem is non-existent.
  2. Pass the option -Duser.timezone=UTC to the JVM at application launch.
  3. Have a static block in the application's Application class (or some superclass) that sets the Java default timezone:
    Code Block
    
    static {
    	TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
    }
    
Note
titlePostgresql 9.0+ and bytea columns

In Postgresql 9.0, the default value for bytea_output changed from 'escape' to 'hex'. I've had an issue where the value written in to the db was read out incorrectly due to this. To fix the problem in PGAdmin3, right click on your database, and select the 'Properties' context menu option. In the properties window that pops up, select the 'Variables' tab, and set the value appropriately. Image Added

PostgresqlPlugin Framework

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 WOCommunity Jenkins server (either Wonder for WebObjects 5.3 or Wonder of WebObjects 5.4), 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)

Image Added