Web Stack Getting Started Guide

ProcedureTo Set Up PostgreSQL

  1. Create a user by name postgres.


    bash-3.2$ su
    Password: 
    # chown postgres:postgres /var/postgres/8.2/data 
    # su - postgres
  2. Initialize the database.


    bash-3.2$/usr/postgres/8.2/bin/initdb -D /var/postgres/8.2/data

    The files belonging to this database system are owned by user postgres. This user must also own the server process. The database cluster is initialized with locale C.

  3. Start the database server.


    bash-3.2$/usr/postgres/8.2/bin/postgres -D /var/postgres/8.2/data

    or


    bash 3.2$/usr/postgres/8.2/bin/pg_ctl -D /var/postgres/8.2/data -l logfile start
  4. Enable PostgreSQL version 8.2.


    bash-3.2$ su
    Password: 
    # /usr/sbin/svcadm enable postgresql:version_82
  5. Configure the PostgreSQL database with NetBeans IDE 6.0.

    1. Create a New Database Connection.

      In the New Connection Database dialog box, enter the following details:

      • Name — PostgreSQL

      • Driver — org.postgresql.Driver

      • Database URL — jdbc.postgresql://localhost.5432/postgres

      • User — postgres

      • Password — ******

    2. Click the Advanced tab.

    3. Select a Database Schema to use.

    4. Create a Table.

    5. View the Table Data.