Using JDBC with PostgreSQL at IMADAThis note explains how to use JDBC with PostgreSQL, in particular with the PostgreSQL system at IMADA.
First, you need access to a driver. For the versions (PostgreSQL 7.3 and
Java 1.5) at IMADA, the appropriate driver is pg73jdbc3.jar.
It can be found at most linux machines at IMADA as
Next, you need to update your environment variable
if you are using the
In case you are running the
should do it (if you do not know which shell you are using, simply try each command - only the one for your shell will succeed).
This should be done each time you log into a machine at IMADA, unless
you include the command as a line in your
Here is an example of a Java program using
JDBC, which should work on all IMADA machines. It accesses a database
with a relation For more details on using JDBC, see the JDBC documentation for PostgreSQL and the documentation for the java.sql package in Java. For allowed matches of SQL types and Java types in JDBC, see section 5.1.6 of Getting Started with the JDBC API guide.
One issue is the interaction of encoding of data between Java, PostgreSQL,
and textfiles with data loaded using the
This uses UTF-8 as encoding in the database. Using the same for textfiles
with data should eliminate encoding problems. The available encodings in
PostgreSQL are listed in the
documentation.
The Unix command
Maintained by Rolf Fagerberg (rolf@imada.sdu.dk) | |