I have a problem using jdsk.
first I have installed postgre in a server using some rpms:
postgresql-libs-7.2.4-5.80.i386.rpm
postgresql-7.2.4-5.80.i386.rpm
postgresql-server-7.2.4-5.80.i386.rpm
postgresql-devel-7.2.4-5.80.i386.rpm
postgresql-docs-7.2.4-5.80.i386.rpm
postgresql-jdbc-7.2.4-5.80.i386.rpm
postgresql-test-7.2.4-5.80.i386.rpm
postgresql-tk-7.2.4-5.80.i386.rpm
postgresql-tcl-7.2.4-5.80.i386.rpm
postgresql-odbc-7.2.4-5.80.i386.rpm
postgresql-perl-7.2.4-5.80.i386.rpm
postgresql-python-7.2.4-5.80.i386.rpm
postgresql-contrib-7.2.4-5.80.i386.rpm
all this stuff using Linux red hat 8.0
Now in the client I am using Windows 2000, and there I have installed
C:\j2sdk1.4.1_05
there I had set the path :
C:\>set path=%PATH%;C:\j2sdk1.4.1_05\bin
I had installed the pg72jdbc2.jar file in this directory
C:\j2sdk1.4.1_05\jre\lib\ext
And I have modifyed the classpath
C:\>javac -classpath C:\j2sdk1.4.1_05\jre\lib\ext
after thatIg o to my source:
import java.sql.*;
class PostgreSQLTest {
public static void main (String[] args) {
java.sql.Connection conn;
try{
Class.forName("org.postgresql.Driver");
String url = "jdbc:postgresql://161.135.1.27/javatest";
conn = DriverManager.getConnection(url,"postgres","postgres");
System.out.println("coneccion ok");
Statement stm = conn.createStatement();
stm.setQueryTimeout(10);
ResultSet rs = stm.executeQuery("select col1 from test");
rs.next();
System.out.println(rs.getString(1));
}catch(Exception e){
System.out.println("Exception!");
System.out.println(e.toString());
}
}
}
that is stored in a file called PostgreSQLTest.java
then I go to the directory where is stored the file .java
and I type:
C:\LDS_java>javac PostgreSQLTest.java
C:\LDS_java>java PostgreSQLTest
Exception!
java.lang.ClassNotFoundException: org.postgresql.Driver