From: | ed(at)ednevitible(dot)co(dot)uk |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Postgre not able to connect |
Date: | 2004-04-14 20:53:04 |
Message-ID: | 20040414215304.243bc14e.ed@ednevitible.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hello I have downloaded the postgre driver for java, and tried to run
the following code;
import java.io.*;
import java.sql.*;
public class DataBase
{
public static void main(String args[])
{
try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException cnfe) {
System.err.println("Couldn't find driver class:");
cnfe.printStackTrace();
}
System.out.println("Testing");
}
}
However, I get this output:
ed(at)desktop:~/jbproject$ javac Example1.java && java Example1
Checking if Driver is registered with DriverManager.
Couldn't find the driver!
Let's print a stack trace, and exit.
java.lang.ClassNotFoundException: org.postgresql.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at Example1.main(Example1.java:10)
The driver is there, after reading the documentation I thought, perhaps
I have to rename the .jar file to postgres.jar:
ed(at)desktop:/usr/lib/j2sdk1.4.2$ find . | grep postgres
./jre/lib/ext/postgresql.jar
./lib/postgresql.jar
I am very confused as to what is going wrong.
From | Date | Subject | |
---|---|---|---|
Next Message | Manuel García H. | 2004-04-14 21:40:16 | Problems with batch using jdbc on postgresql 7.4.2 |
Previous Message | Kris Jurka | 2004-04-14 06:04:31 | Re: patch: fix TimeTest in timezones ahead of GMT |