Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 12-12-2009, 09:34 AM   #1
Registered: Apr 2005
Location: Durban
Posts: 433

Rep: Reputation: 30
Query a postgres database with Java


I'm trying to do what it says on the tin. (Query a postgres database with Java). On a Debian Lenny box.

I've installed the java and have these 2 directories in
ls /usr/lib/jvm/
java-1.5.0-gcj-4.3-  java-gcj
Java is set up thus:
ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 2009-12-12 13:10 /usr/bin/java -> /etc/alternatives/java
Which, if I run it gives this:
Usage: gij [OPTION] ... CLASS [ARGS] ...
          to invoke CLASS.main, or
       gij -jar [OPTION] ... JARFILE [ARGS] ...
          to execute a jar file
Try `gij --help' for more information.
I have followed the directions here: but when I try to run the demo program I get the following errors:

Exception in thread "main" java.lang.NoClassDefFoundError:
Caused by: java.lang.ClassNotFoundException: not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:/usr/share/java/postgresql-jdbc3-8.2.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
   at gnu.gcj.runtime.SystemClassLoader.findClass(
   at java.lang.ClassLoader.loadClass(
   at java.lang.ClassLoader.loadClass(
My Postgres version would appear to be 8.3.:
 psql --version
psql (PostgreSQL) 8.3.8
contains support for command-line editing
Does anyone have any suggestions?

I have visited Sun's dowload site and downloaded jdk-1.6.bin which I've run but which just extracted out to a directory jdk1.6.0_17 which I've placed in /usr/lib/jvm but which needs to be configured (obviously through /etc/alternatives if I can work it out).

I've done a fair bit of googling which seems to suggest that incompatibilities in the gij which might be causing it.
Old 12-12-2009, 10:29 AM   #2
Registered: Apr 2005
Location: Durban
Posts: 433

Original Poster
Rep: Reputation: 30

No wonder I'm having difficulty, I've just noticed the bloody article I'm using is dated 2003.


The 'net is littered with all these howtos that are out of date. </rant>

Can anyone recomend a reasonably up-to-date?

I'm trying to feed an excel worksheet into a postgres database using hssf/poi which are java apps, which is why I need Java to connect to the Postgres JDBC.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scripts updating a postgres database ethnicme Programming 1 07-15-2006 11:21 AM
create table in postgres database kranti Linux - Newbie 1 11-15-2005 07:52 PM
Problem with Postgres Database Connection anjani.78 Linux - Software 1 10-07-2005 03:06 AM
changing password for postgres database anjani.78 Linux - Software 1 07-18-2005 11:58 PM
Connecting a Postgres Database from a Java application Paulo Ges Programming 4 08-23-2003 11:08 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:52 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration