PostgreSQL with NeoOffice/J

NeoOffice/J, the only usable version of OpenOffice for the Mac supports external datasources. JDBC, even. There’s JDBC support for PostgreSQL too, so hooking them togther should be easy, right?

<p>Well, almost.</p>
<p>There are a few tricks and not-easily-accesible bits of information you’ll need to get it running.  First, go to the <a href="http://jdbc.postgresql.org/download.html"><b>JDBC driver site</b></a> and download the right version of the the JDBC driver binary.  Ah, you’ve found the first trick.</p>
<p>The version of PostgreSQL you’re running is easy enough to determine but what you might not know is that NeoOffice/J is linked against <b>Java 1.3</b>, even if you have Java 1.4 or Java 1.5 installed.  But the Java 1.3 version of the JDBC driver isn’t right either - you need the <b>JDBC 2 EE</b> version.  So, go down that column, find the version of PostgreSQL you’re running and install it.</p>
<p>Right, so how do you do that?  Easy - drag the .jar file to <b>/Library/Java/Extensions</b> .  The Finder will ask you to authenticate.</p>
<p>Now, start up NeoOffice/J.  If it’s already running, <b>quit, then start it again</b>.  You’ve been warned.</p>
<p>Go to <b>Tools…Data Sources…</b> and click ‘New Data Source’ on top of the left-hand column.  Belive it or not that’s a button.  Give it a name (the name of your database is good) choose JDBC as the connection type, and for the URL enter:</p>
<p><b>postgresql://127.0.0.1/datbasename</b></p>
<p>That assumes you’ve got PostgreSQL running locally or have an SSH port forward (ssh -L<b>5432</b>:127.0.0.1:5432 user@example.com) in place to your Internet-connected database.  Substitute a different IP address if required.</p>
<p>Now then, click the JDBC tab and enter:</p>
<p>  <b>org.postgresql.Driver</b></p>
<p>as the JDBC driver class.</p>
<p>put in the PostgreSQL user name (you created a new user with the correct GRANT-ed permissions, right?) and click ‘password required’.  If you don’t use passwords, you’re on your own.</p>
<p>Now then, click the Tables tab and it’ll ask you for your password, and, all things being equal, connect you to your database and show you your table structure.</p>
<p>To see your data, close this window and choose <b>View…Data Sources</b> from the menu bar.  Voila.