From: | Bernardo López <bernardolg(at)gmail(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | org.postgresql.Driver |
Date: | 2005-11-18 02:51:13 |
Message-ID: | 3ba0be70511171851u5c0b387emedbf4e45f22b64fa@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Greetings!
I am starting to learn Java, and starting to use PostGreSQL too.
I need some major help here.
I am working under Windows XP Home Edition, and working with:
PostgreSQL 8.0.
pgAdmin III, v. 1.2.2.
jdk1.5.0_04.
JCreator 3.50 LE.
I am trying to run this example:
// File Connect.java
// Code starts here.
import java.sql.*;
public class Connect {
public static void main(String[] args) {
Connection cnn;
try {
Class.forName("org.postgresql.Driver");
cnn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/","postgres","");
Statement stmt = cnn.createStatement();
int login=1;
ResultSet rs = stmt.executeQuery("select * from usuarios");
if (rs!=null) {
while (rs.next()) {
System.out.println(rs.getString("login"));
System.out.println(rs.getString("password"));
System.out.println(rs.getString("nombre"));
}
}
rs.close();
stmt.close();
cnn.close();
} catch (Exception e) {
System.out.println(e);
}
}
}
// Code ends here.
But I keep getting the error message:
java.lang.ClassNotFoundException: org.postgresql.Driver
I've read a couple of related messages in this and other forums, but
nothing yet.
After many attempts, my PATH, CLASSPATH and other environment
variables are set like this:
- - - -
PATH
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%JAVA_HOME%\bin
- - - -
JAVA_HOME
C:\Archivos de programa\Java\jdk1.5.0_04
- - - -
CLASSPATH
%JAVA_HOME%\jre\lib;"C:\Archivos de
programa\PostgreSQL\8.0\jdbc\postgresql-8.0-311.jdbc2.jar";"C:\Archivos
de programa\PostgreSQL\8.0\jdbc\postgresql-8.0-311.jdbc2ee.jar";"C:\Archivos
de programa\PostgreSQL\8.0\jdbc\postgresql-8.0-311.jdbc3.jar"
- - - -
QTJAVA
"C:\Archivos de programa\Java\jre1.5.0_04\QTJava.zip"
- - - -
All help will be appreciated!
Keep posting!
From | Date | Subject | |
---|---|---|---|
Next Message | Announce | 2005-11-18 03:49:44 | Re: org.postgresql.Driver |
Previous Message | ryan miller | 2005-11-17 23:53:12 | Problem Accessing PostgreSQL from Perl CGI |