PostgreSQL resources


PostgreSQL in Bladen Computer Labs

The environment

The PostgreSQL database system, version 8.2.5, is installed in the MathLab Cluster. The path to it is /usr/postgresql/postgresql. Your professor will provide you three fields required to access the PostgreSQL: database name, database username, and the password. The database name and the database username are generally the same. Also, note that only local database connections are enabled to the PostgreSQL, which means you have to login to this compute node in order to interface with the database.

Connect to the Database

  1. Login to the server that hosts PostgreSQL
       ssh <UTSC_ID>@mathlab.utsc.utoronto.ca
      

  1. Interface with the PostgreSQL
To interface with the PostgreSQL server(s), use the psql command. For example, run one the following commands:

  • Interactive mode: psql -U <database_username>
                This will give you an interactive shell to type in SQL queries.
  • Batch mode: psql -U <database_username> < <file>
                where <file> is a file containing your SQL queries.
                An example is: psql -U huangtest < test1.sql

You can check out PostgreSQL documentation in the man page ( man psql ), and/or at http://www.postgresql.org/docs/8.2/interactive/index.html


Or better yet ... download it and run it on your home computer!

Downloads, documentation, discussions and much more can be found at the PostgreSQL home page.

For those of you who are having problems installing PostgreSQL on your home machines, I reccomend that you exchange ideas on the course newsgroup to help each other out and learn from each other's mistakes and make extensive use of Google and documentation available at PostgreSQL.

Download:


Latest version (as of 2nd of September 2007) is 8.2.4 - However CDF is running 8.1.9. Your assignments must run on CDF. For this reason, you may want to download 8.1.9.

PostgreSQL Documentation:


All Manuals | Version 8.1 | Tutorial | SQL Reference | FAQ

Installation

JDBC

Resources on UTSC - Bladen MathLab Cluster:
  • If you are required to use Java to interface with the PostgreSQL, you need to incorporate the JDBC driver already installed on node3201.
    • The path for the driver is /usr/postgresql/postgresql/share/postgresql.jar.
    • There are also example java files along with the readme which explain how to run it:
      • /usr/postgresql/postgresql/share/HelloPostgresql.java
      • /usr/postgresql/postgresql/share/HelloPostgresql.ReadMe

    Resources at PostgresSQL.org:

    PostgreSQL JDBC Driver | FAQ | Tutorial

    EBooks

    Practical PostgreSQL

    For everything else, there is always our good friend, Google!