JDBC Connectivity..

From: Minal <minalac(at)yes2etl(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Cc: project(at)yes2etl(dot)com, "Shankaramurthy Chockalingam" <shankaramurthy_c(at)rediffmail(dot)com>
Subject: JDBC Connectivity..
Date: 2005-06-20 06:28:06
Message-ID: 42B661F6.4040009@yes2etl.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I am noting down the steps..which I performed during installation and
for using JDBC....
1. DO we have to use ./configure with-java ?
because when I use that I get error that it failed. Is this the reason I
am not able to eshtablish the connectivity...
In O'reily book it is mentioned that we have to build the driver...How
does one do that??
I have copied the postgresql driver in /usr/local/tomcat/common/lib
directory..
also set the class path...restarted the tomcat and used the java file as
shown below...

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

Am I going wrong anywhere??

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Thomas Dudziak 2005-06-20 10:05:35 Exception when inserting boolean values into BIT columns
Previous Message Akhil Srinivasan 2005-06-20 06:27:09 Problems with temporary tables created in callable functions