From: | Dave Cramer <pg(at)fastcrypt(dot)com> |
---|---|
To: | minalac(at)yes2etl(dot)com |
Cc: | List <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: Postgresql-JDBC connectivity |
Date: | 2005-06-16 12:38:45 |
Message-ID: | E6940537-7090-4E0B-91B2-E6373FC652B1@fastcrypt.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Show me the output of echo $CLASSPATH when you run this.
Dave
On 16-Jun-05, at 6:20 AM, Minal wrote:
> I set the classpath, copied in the lib folder of web-inf. If I try
> to run a simple java program shown below:
> import java.sql.*;
>
> public class Example1
> {
> public static void main(String[] argv)
> {
> System.out.println("Checking if Driver is registerd");
> try
> {
> Class.forName("org.postgresql.Driver");
> }
> catch(ClassNotFoundException cnfe)
> {
> System.out.println("Couldn't find the Driver");
> cnfe.printStackTrace();
> System.exit(1);
> }
> System.out.println("registered the Driver OK, so lets make a
> connection");
> Connection c = null;
> try
> {
> c= DriverManager.getConnection("jdbc:postgresql://localhost/
> trainneedcorp","postgres","admin");
> }
> catch(SQLException se)
> {
> System.out.println("Couldnt connect");
> se.printStackTrace();
> System.exit(1);
> }
> if(c != null)
> System.out.println("WE CONNECTED");
> else
> System.out.println("Reaching here is not done");
> }
> }
> I get the following error:
>
> 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)
>
>
> Dave Cramer wrote:
>
>
>> Hi,
>>
>> How are you trying to connect, what is the error message,
>> specifically which lib directory of jakarta did you copy it into?
>>
>> Dave
>> On 16-Jun-05, at 2:46 AM, Minal wrote:
>>
>>
>>> Hi...
>>> I am novice user of Postgresql8.0.3. I managed to export the
>>> database from sql server. We have all our application in JSP. I
>>> want to install the org.postgresql.driver..
>>> I completed the following steps...
>>> 1.Downloaded the jar file from http://jdbc.postgres.org
>>> 2. Copied it in the lib folder of Jakarta..
>>> 3. Edited the pages to use the Driver..am still not able to
>>> connect...
>>>
>>> Where am I going wrong??
>>> Minalac
>>>
>>> ---------------------------(end of
>>> broadcast)---------------------------
>>> TIP 5: Have you checked our extensive FAQ?
>>>
>>> http://www.postgresql.org/docs/faq
>>>
>>>
>>>
>>
>>
>>
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2005-06-16 16:19:20 | org.postgresql.util.PSQLException: The column name x was not found in this ResultSet. |
Previous Message | Tom Arthurs | 2005-06-16 10:42:05 | Re: Postgresql-JDBC connectivity |