From: | Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> |
---|---|
To: | PG-JDBC Mailing List <pgsql-jdbc(at)postgresql(dot)org> |
Cc: | Lior K <liork20002000(at)yahoo(dot)com> |
Subject: | Re: Can't connect to posgresql through the jdbc driver |
Date: | 2010-03-03 03:20:15 |
Message-ID: | 4B8DD56F.9040109@postnewspapers.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
[ Replying to list, since poster replied directly to me. I've trimmed
the reply and fixed the broken quoting; please quote correctly in future
replies and reply to the list, not directly to me].
Lior K wrote:
>> Craig Ringer wrote:
>> What's the exact value of CLASSPATH as you set it?
>
> from within .bashrc :
>
> CLASSPATH=$CLASSPATH:/opt/PostgreSQL/pgJDBC/
> export CLASSPATH
>
>> Did you set it to the directory containing the .jar ? Or to the .jar its
>> self? You need to put the actual .jar on the CLASSPATH.
>
> 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? Just define libraries and add them to your
netbeans project. See the netbeans introductory tutorial, the built-in
help, the "Libraries" folder in the project, and the "Libraries" entry
in the Tools menu.
For example, I created a library "PostgreSQL JDBC Driver", and added the
postgresql-8.4-701.jdbc.jar to it. If I wanted to use that in an Ant
project (the default netbeans project type) I'd just right-click on the
library list and add "PostgreSQL JDBC Driver" to the list. Now netbeans
will add it to the classpath automatically, copy it into the dist folder
when I do a project build, bundle it up in my application jar when I do
a jar build, and otherwise just take care of it for me.
If you add the sources and javadoc to the library too, you get
source-level debuggging, JavaDoc autocomplete, etc for the library too.
Right now, you're doing things the hard way! You'll get a lot further by
reading the documentation in Netbeans and the basic documentation on the
JVM, "java" command, etc.
( Alternately, if you use Maven, and add a dependency for:
Artifact: postgresql
Group: postgresql
Version: 8.4-701.jdbc4
and it all automagically just happens ).
--
Craig Ringer
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Kellerer | 2010-03-03 07:11:39 | Re: Can't connect to posgresql through the jdbc driver |
Previous Message | Craig Ringer | 2010-03-03 00:55:46 | Re: Can't connect to posgresql through the jdbc driver |