Translations of this page:

HOWTO Configure PostgreSQL

ZipTie does not ship with PostgreSQL, therefore it is assumed that PostgreSQL is already installed on your system. ZipTie requires PostgreSQL 8.1 or above, and has only been tested with 8.2.5.

PostgreSQL can be downloaded from the following locations:

In the case of Linux, it is suggested that you use the appropriate package manager for your distribution to install PostgreSQL.

Creating the Database

Mac OS X

Follow the instructions on this page http://www2.russbrooks.com:8080/2007/11/4/install-postgresql-on-mac-os-x-10-5-leopard.

You may have to use the “Service Manager” tool under Applications/PostgreSQL to cycle the server. In fact, it's not a bad idea. If the service won't restart, it is probably due to the shared memory issue referred to on the above referenced page.

Once your server is running, run the “Create Database” tool under Applications/PostgreSQL. On the second panel use “ziptie” as the database name.

Linux

Someone with experience creating a database on Linux insert instructions here. It is probably the same command line as the instructions for Mac OS X, but executed in a different directory (such as /usr/local/postgresql).

Windows

When installing PostgreSQL on Windows, make sure to select UTF-8 as the encoding. It is on the third or fourth installation panel of the PostgreSQL installer.

After installation, run the pgAdmin tool from the Start/Programs menu. Connect to the PostgreSQL server using the password you supplied during installation. Right-click on the Databases node in the “Object Browser” view on the left, and select New database…. The database must be called ziptie, and the encoding should be set to UTF8. The following values are suggested.

Field Value
Name ziptie
Owner postgres
Encoding UTF8
Template postgres
Tablespace pg_default

Changes to the ZipTie Build Environment

In the Build project directory, create a file named user.properties with the following contents:

database=pgsql

Execute Ant with the following target:

ant dbreset

The first time you run this target after setting up PostgreSQL, you will see many error messages. These are not critical error messages and are only emitted because the target attempts to drop existing tables (of which there are none, initially). Subsequent invocations of the dbreset target will not encounter this error.

If you want to switch back and forth between Derby and PostgreSQL, you can override the database property defined in user.properties by specifying the database on the command line, like so:

ant -Ddatabase=derby dbreset

or:

ant -Ddatabase=pgsql dbreset

Defining the database in user.properties is merely a shortcut to not have to specify the database every time you perform a dbreset during development.

Windows

By default in development the JDBC connection URL for PostgreSQL is defined to use the user postgres and no password. However, on Windows I was unable to create the postgres user without also defining a password, therefore the connection URL must be changed before ZipTie will be able to connect to the database. Edit the osgi-config/c3p0/c3p0-config.pgsql.xml file and change the line:

<property name="jdbcUrl">jdbc:postgresql://localhost/ziptie?user=postgres</property>

to:

<property name="jdbcUrl">jdbc:postgresql://localhost/ziptie?user=postgres&amp;password=ziptie</property>
 
dev/howto_postgresql.txt · Last modified: 2007/12/21 01:31 by brettw
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki