Personal tools
You are here: Home Developers Corner Java API documentation Installing and Using Postgres database
Document Actions

Installing and Using Postgres database

by Wayne Boucher last modified 2008-01-11 18:07

Summary of how to install Postgres database for use with SQL API.

Download postgres release from:

    http://www.postgresql.org/download/

For example, in January 2008 the stable release was postgresql-8.2.6.tar.gz.

Unpack this:

    tar xvzf postgresql-8.2.6.tar.gz   (or whatever file)

Compile and install:

    cd ~/postgresql-8.2.6   (or whatever directory)

    ./configure --prefix ~/pgsql   (assuming you want installation in this directory)

    make

    make install

All commands are in ~/pgsql/bin, so can add that to your path, or just add path explicitly when you run commands.

Initialise database:

    cd ~/pgsql/bin

    initdb -D ~/pgsql/data

To start server:

    postmaster -D ~/pgsql/data >logfile 2>&1&

To create database "test":

    createdb test

To create user "postgres":

    createuser postgres
    [ asked "Shall the new role be a superuser? (y/n) ]

To start interactive client on database "ccpntest":

    psql ccpntest

To describe all tables in database "ccpntest" from inside psql client:

    ccpntest=# \dt


To describe specific table in database "ccpntest" from inside psql client:

    ccpntest=# \d TABLE_NAME


   


Powered by Plone, the Open Source Content Management System

This site conforms to the following standards: