Skip site navigation (1) Skip section navigation (2)

Re: Not able to connect to postgresql database

From: Maciek Sakrejda <msakrejda(at)truviso(dot)com>
To: Manohar Bhattarai <manoharbhattarai(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Not able to connect to postgresql database
Date: 2010-06-01 20:30:44
Message-ID: AANLkTinhQuFqfz3Uc27-kSDFAPsvkjXmI-EA3Q_BLCKf@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
Well, first of all, you may want to stick with a single driver jar.
8.4 is backwards compatible with 8.3, so you should probably use 8.4,
and jdbc3 vs. jdbc4 is a Java version issue--jdbc4 for Java 6 and up,
jdbc3g for Java 5. I'm not sure what happens if you try to load
different definitions of the same class four times (not to mention
that I'm not sure how it's even possible, since the 3g and 4 versions
are compile-time incompatible with projects using a different Java
version).

If you're still getting errors, try an explicit

Class.forName("org.postgresql.Driver");

and see if you still get an Exception. If so, it sounds like an
Eclipse configuration issue since the jar isn't showing up in your
classpath.
---
Maciek Sakrejda | System Architect | Truviso

1065 E. Hillsdale Blvd., Suite 230
Foster City, CA 94404
(650) 242-3500 Main
(650) 242-3501 F
www.truviso.com



On Tue, Jun 1, 2010 at 1:19 PM, Manohar Bhattarai
<manoharbhattarai(at)gmail(dot)com> wrote:
> Hi,
>  I am a newbie for postgresql. I am trying to connect to postgresql database
> using jdbc. I googled about it and got the Driver string and connection
> string formats. I tried using some examples i got on the internet. But my
> program is not able to connect to postgresql and shows an exception that it
> cannot find driver. I am doing it in Ubuntu8.04 Linux with Postgresql 8.3
> installed. I am using Eclipse galileo as IDE. I created database using
> commands in terminal. I have added the external jar files for postgresql
> jdbc connector(postgresql-8.3-603.jdbc3.jar, postgresql-8.3-603.jdbc4.jar,
> postgresql-8.4-701.jdbc3.jar and postgresql-8.4-701.jdbc4.jar) in my project
> also.
> Please help me and let me know what i am doing wrong and what i am missing.
> Can you please give an example code if possible?
> Thanks
> --
> Regards,
> Manohar Bhattarai (मनोहर भट्टराई)
> Blogs:
> http://manoharbhattarai.wordpress.com/
> http://manoharbhattarai.posterous.com/
> http://manoharbhattarai.blogspot.com/
> Microblogs:
> Twitter :- http://twitter.com/manoharmailme
> Identi.ca :- http://identi.ca/manoharbhattarai
>

In response to

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2010-06-01 20:34:42
Subject: Re: Found a Bug in latest Driver (I THINK) and pg 8.4
Previous:From: Kevin GrittnerDate: 2010-06-01 20:27:39
Subject: Re: Not able to connect to postgresql database

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group