Re: Can't connect to posgresql through the jdbc driver

From: Kyran O Reilly <kyranoreilly(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Can't connect to posgresql through the jdbc driver
Date: 2010-09-02 15:41:20
Message-ID: loom.20100902T173332-659@post.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Thomas Kellerer <spam_eater <at> gmx.net> writes:

>
> Craig Ringer, 03.03.2010 04:20:
> >> I set it to the jar file as written above
> >
> > No, you didn't. You set it to the folder CONTAINING the jar. Try:
> >
> > CLASSPATH=$CLASSPATH:/opt/PostgreSQL/pgJDBC/postgresql-8.4-701.jdbc.jar
> >
> >> I am using netbeans 6.8 ... The project I chose was a java application .
The application is supposed to
> connect to a database which parameters (DB name , userName,Password ) I pass
through netbeans config file
> option (under the "run" section in the menu. I also tried to run it manually
with this line:
> >
> > Eh? If you're using NetBeans, why are you messing with the CLASSPATH
> > environment variable?
>
> Actually nowadays one should never use a system wide CLASSPATH, because it
simply leads to a lot of problems.
>
> Either the IDE manages that or the classpath is defined using the -cp
parameter when starting the Java
> program. Or - most user-friendly - create an executable jar file that defines
all needed libraries.
>
> Thomas
>

Using NetBeans 6.9.1

2 Steps

1)
Tools -> Libraries. Scroll down on left side of window. Select Postgresql and on
the right Click Add Jar or Folder and point it to the jar file. Click OK.

2)
Within the project you are working on, in the Projects tab on the left hand
sidee of the window, right click the project you want and choose Properties.
Click Libraries choice (under Categories.) On right hand side on the Compile tab
click the add library button and choose Postgresql. Click add library. Click OK.

Now it should find and load Driver.

All the Best

Kyran

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Florian Weimer 2010-09-06 12:09:25 Re: uuid values as parameters
Previous Message Alessandro Di Bella 2010-09-02 15:04:36 Bug in implementation of java.sql.DatabaseMetaData