Wiki source code of Project WONDER-Frameworks-PostgresqlPlugin
Version 29.1 by Paul Hoadley on 2010/12/07 01:28
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | To use PostgreSQL as the persistence layer with WebObjects, you need the PostgreSQL JDBC driver and the PostgresqlPlugIn framework from Project Wonder. | ||
2 | |||
3 | = JDBC Driver = | ||
4 | |||
5 | 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>>http://jdbc.postgresql.org/download.html]]. | ||
6 | |||
7 | There are several ways to install the driver: | ||
8 | |||
9 | 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 JARs in the extensions directory carries caveates 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.)// | ||
10 | 1. Put the JAR in the ##Libraries## directory of a specific application. | ||
11 | 1. Create a framework containing the JAR in ##Libraries##, and then reference that framework from your applications. | ||
12 | |||
13 | = PostgresqlPlugin Framework = | ||
14 | |||
15 | 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>>http://wiki.objectstyle.org/confluence/display/WO/Project+WONDER-Quickstart]]. Otherwise, you can download the built frameworks from the [[mDimension Hudson build server>>http://webobjects.mdimension.com/hudson/]] (either [[Wonder53>>http://webobjects.mdimension.com/hudson/job/Wonder53/lastSuccessfulBuild/artifact/dist/Wonder-Frameworks.tar.gz]] or [[Wonder54>>http://webobjects.mdimension.com/hudson/job/Wonder54/lastSuccessfulBuild/artifact/dist/Wonder-Frameworks.tar.gz]]), 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.,, | ||
16 | |||
17 | = Using PostgreSQL in Entity Modeler (WOLips) = | ||
18 | |||
19 | [[image:PostgresSQL-EM.png]] | ||
20 | | ||
21 | |||
22 | = Legacy topics = | ||
23 | |||
24 | == PostgreSQL EOModeler Bundle == | ||
25 | |||
26 | 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>>http://en.wikibooks.org/wiki/Programming:WebObjects/Project_WONDER/Installing]] 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 /Developer/EOMBundles folder because EOModeler decides it doesn't want to look in that folder. | ||
27 | |||
28 | == Using PostgreSQL in EOModeler == | ||
29 | |||
30 | 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: | ||
31 | |||
32 | URL: jdbc:postgresql:~/~/yourhost/yourdatabase | ||
33 | Username: whatever | ||
34 | Password: whatever | ||
35 | Driver: org.postgresql.Driver | ||
36 | Plugin: PostgresqlPlugIn | ||
37 | |||
38 | **NB**: When the SQL is being generated for your model to populate your database server's schema, EOF will typically connect to the database server to check information about various types that the database server will support. Sometimes this is very inconvenient when you are away from direct access to the database server. For this reason, the plugin contains a hard-coded set of PostgreSQL 8.2 types and you can specify that you want to use those by adding the ##?useBundledJdbcInfo=true## to the end of the connection URL. |