Project

Description

Access from Java and Python

In the directory dbconnect/ you find two programs dbtest.py and
DBTest.Java. The files contain information on how to run them. They use small libraries dbconnector.py
and DBConnector.java that handle the setup of a database connection. The libraries are smart enough to
figure out when an SSH tunnel is need and set that one automatically up. The test programs contain a minimal
example of how to perform an SQL query.
Thanks go to Jesper Lund who implemented a far pre-cursor of DBConnector.java.

Database Accounts

Accounts for the database server can be obtained by sending me an e-mail with your IMADA account and a
password (not necessarily your IMADA password). If you are unable to setup an account before Tuesday's
exercise, the teaching assistant should be able to assist you.

Web Interface>

Database Clients

To access the database you can either use the web interface as described below, a graphical
frontend (like pgadmin) or you can
use a local client (psql). How to obtain such a local client depends on the operating system:

Linux:
If psql is not available on your linux system, tell the administrator
or use the package manager to install it. Make sure it is able to connect to the
server (which runs PostgreSQL 8.4).

Mac OS X
You can download the full PostgreSQL package from PostgreSQL.org.
Note that this gives you both the server and the client. You might want to switch off the server
if you are using the course's remote server.
Alternatively you can use MacPorts
to install postgresql84.

Windows:
There is a client-only package available from PostgreSQL Frontend for Windows.
Alternatively, you can download the full PostgreSQL package from PostgreSQL.org.
Note that this gives you both the server and the client. You might want to switch off the server
if you are using the course's remote server.

Remote Access to the Database

You should be able to access your account from the IMADA terminal room or the IMADA
notebook network using a local client (e.g. psql -h 10.110.4.32 -p 5434 -U username username), the address 10.110.4.32 and the port 5434.

The server is not directly accessible from outside IMADA, but you can use an SSH tunnel:

ssh -L 5434:10.110.4.32:5434 username@logon9.imada.sdu.dk

Then you can access the database server with a local
client (e.g. psql -p 5434 -U dbusername dbusername) as localhost.

You can also have it more comfortable by putting the
following lines into ~/.ssh/config: