Re: Exception Error - Please help I've tried everything!

Поиск
Список
Период
Сортировка
От Chuck Davis
Тема Re: Exception Error - Please help I've tried everything!
Дата
Msg-id 883e44790611260746h5b75162eue52207ee6505e2a7@mail.gmail.com
обсуждение исходный текст
Ответ на Exception Error - Please help I've tried everything!  ("Greg Peters" <gregpeters79@gmail.com>)
Ответы Re: Exception Error - Please help I've tried everything!  ("Greg Peters" <gregpeters79@gmail.com>)
Список pgsql-jdbc
Greg:

If you're running from inside NB you need to add the PG driver as a
library to NB.  If you have the driver on your classpath then your
class should run fine outside of NB.  Test and let us know if it runs
outside of NB or if you have success adding the driver as a library in
NB.

I use Postgresql and it works beautifully.  Be encouraged that if you
get the right combo you'll have a superior environment!

Chuck

On 11/25/06, Greg Peters <gregpeters79@gmail.com> wrote:
> Hello all,
>
> I'm trying to get the following simple program to run just to confirm a
> connection to the database:
>
> //PostgresqlClient.java
>
> import java.sql.*;
>
> public class PostgresqlClient{
>     public static void main(String[] arguments)
>         throws ClassNotFoundException, SQLException{
>
>         String driver = "org.postgresql.Driver";
>         String url ="localhost";
>         String user = "root";
>         String pwd = "password";
>
>         Class.forName(driver);
>
>         Connection con = DriverManager.getConnection(url, user, pwd);
>         System.err.println("Connection complete");
>
>         con.close();
>     }
> }
>
>
>
> I keep getting the folowing errors:
>
> Exception in thread "main" java.lang.ClassNotFoundException:
> org.postgresql.Driver
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:164)
>         at PostgresqlClient.main(PostgresqlClient.java:12)
> Java Result: 1
> BUILD SUCCESSFUL (total time: 0 seconds)
>
> I have tried adding the postgresql.jar file to my CLASSPATH, and have also
> tried copying the postgresql.jar file to the same directory as the
> PostgresqlClient.java and PostgresqlClient.class directories. I have also
> tried running the following from the command line:
>
> java -classpath postgresql.jar PostgresqlClient.class
>
> I am using jdk1.5.0_09 and have tried using nearly all the available
> postgresql.jar files available.
>
> Any advice would be most appreciated.
>
> Cheers,
>
> Greg Peters....
>
>

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: binary tuple receiving patch v4
Следующее
От: matrixx
Дата:
Сообщение: Re: NPE in BlobInputStream