How to use jdbc?

Adrian Custer
Sat Jul 28 13:50:00 GMT 2001

Hey everyone, 

...continuing this converstaion on the list...

I'm using gcj to compile a program to access a postgresql database. For
the moment the database is on this same machine but this should work
across the network since java can only use network sockets.

I'm on mandrake 8.0++ (cooker). The distribution has a number of
postgresql rpm's including the jdbc so I don't actually know how hard it
is to compile. The jdbc rpm includes a critical java archive. In the
PosgreSQL JDBC documentation, this is called postgresql.jar (e.g. ) but in Mandrake that file is
jdbc7.0-1.2.jar which is found in the directory /usr/share/pgsql/. 

I copied that file into the directory where my java code was and ran the
gcj --main=DatabaseTester -o DatabaseTester jdbc7.0-1.2.jar
	(grr. Evolution wraps that line.)
The code file is an attachment to a previous post. I suspect that I
could simply have setup the classpath variable to find the file but I've
never understood the classpath variable cleanly. 

(For anyone, checking this against a blackdown java setup, to use the
javac compiler, put the jdbc7.0-1.2.jar in the ext/ folder as in:

That's all. It's actually quite clean. I use a Makefile that looks like

#A makefile for both gcj and javc
        gcj --main=DatabaseTester -o DatabaseTester jdbc7.0-1.2.jar 
# The above should be a single line, evolution is word wrapping it.


        doxygen docs/

        rm -f *.class *~ \#*\#


        /usr/local/j2sdk1.3.0/bin/java  DatabaseTester 
#end of makefile.

I hope that helps anyone who is interested in playing with this.


On 28 Jul 2001 14:19:26 -0600, Tom Tromey wrote:
> >>>>> "Adrian" == Adrian Vance Custer <> writes:
> Adrian> Beautiful! Another late night hiccup. This is really good
> Adrian> news, first that gcj supports jdbc and second that it does so
> Adrian> this transparently.
> You're using it with Postgresql?
> Was it hard to build the Postgres JDBC library?
> Let us know how it works out for you.
> I don't know how much the java.sql in libgcj has been tested.
> I'm definitely interested in how well it works, and also how well it
> interacts with Postgres.
> Tom

More information about the Java mailing list