java + debian + postgresql
hey all!!!
i ve got a problem with connecting postresql on debian with (to) java application. this problem is quite common (i have done my research on the internet) and there is a lot about it on the net but i just don't seem to be able to resolve this.
anyway
os = debian sarge
java =
nikdo@debil:~/java/postres$ java -version
java version "1.5.0_10"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)
Java HotSpot(TM) Client VM (build 1.5.0_10-b03, mixed mode, sharing)
postgres =
nikdo@debil:~/java/postres$ psql --version
psql (PostgreSQL) 7.4.7
contains support for command-line editing
i have downloaded postgresql-8.0-319.jdbc3.jar postgresql-8.1-409.jdbc3.jar postgresql-8.2-505.jdbc3.jar and have tried to use them one by one (from 8.2 to 8.0) and nothing
so then i downloaded the source of the driver (via cvs) and compiled it into postgresql.jar and tried again and again nothing.
so i looked on the internet and found all the $CLASSPATH vars and so (actually i already knew about those due to the first build failure) and set those, tried my luck number of times and nothing so i unset them again and tried with javac -cp <path to the file> and have made sure that it is the whole path (the *.jar file included) and again nothing. so i have tried
java -Djdbc.drivers=org.postgresql.Driver neco.javaoption when compiling and again nothing. well simply i don't know what else to do. if anyone can help me.... i would really appreciate that!!!!
the only lead i have got is this...
code:
import java.sql.*;
public class neco{
public static void main(String[] vik){
try{
Class.forName("org.postgresql.Driver");
System.out.println("ok");
}catch(ClassNotFoundException cnfe){
System.out.println("no good");
//cnfe.printStackTrace();
}
}
}
when i compile like
javac neco.java = then no error
when run
java neco = then it throws the exception text 'no good'
when i compile like
javac -cp <path to *.jar file> neco.java = no error
when run
java -cp <path to *.jar file> neco = then no exception text but 'Exception in thread "main" java.lang.NoClassDefFoundError: neco'
that i suppose is quite the same thing but it confuses me why it gives 2 different types of error text.
well that's about all
thanks
vella

