Re: pgsql jdbc db connection weird behaviour

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Venkateswar Reddy Melachervu <vmelachervu(at)gmail(dot)com>
Cc: Steven Schlansker <stevenschlansker(at)gmail(dot)com>, List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: pgsql jdbc db connection weird behaviour
Date: 2014-03-31 12:38:04
Message-ID: CADK3HHLywanyPq2tiYFWo-VwE97vfzPBa8++uak0OS9cRd6xZQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Even if there was a duplicate the Jdbc4Connection should be able to be cast.

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca

On Sun, Mar 30, 2014 at 2:47 AM, Venkateswar Reddy Melachervu <
vmelachervu(at)gmail(dot)com> wrote:

> Steve,
> I've checked it - appears no duplicate jdbc drivers..:-(
>
>
> On Sun, Mar 30, 2014 at 10:59 AM, Steven Schlansker <
> stevenschlansker(at)gmail(dot)com> wrote:
>
>>
>> On Mar 30, 2014, at 12:10 AM, Venkateswar Reddy Melachervu <
>> vmelachervu(at)gmail(dot)com> wrote:
>>
>> > Hello PGSQL Community,
>> > Love pgsql. But facing this weird problem (detailed below) for past
>> couple of days with pgsql jdbc41 driver with tomcat 8 connection pooling on
>> on jvm1.8 (all on x64 windows 8) with no resolution in sight for casting a
>> jdbc db tomcat pooled connection to PGConnection hitting the wall.
>> >
>> > I am sure not sure if I am doing something silly or it is the
>> limitation of pgsql jdbc41 driver. Did any one face any such issue? Does
>> any one know some way out for this?
>> >
>> > Problem:
>> > When I try to cast a DB Connection obtained using tomcat jdbc resource
>> (pooled) to org.postgresql.PGConnection, of course after unwrapping it,
>> execution is running into exception with the message:
>> (java.lang.ClassCastException) java.lang.ClassCastException:
>> org.postgresql.jdbc4.Jdbc4Connection cannot be cast to
>> org.postgresql.PGConnection
>>
>> Almost always this is caused by having more than one driver jar file
>> available in your class path. In particular, bundling a driver in the
>> Tomcat lib/ directory as well as within your application itself is sure to
>> cause problems.
>>
>> That's where I would look first.
>>
>> Hope that helps,
>> Steven
>>
>>
>
>
> --
> Regards,
> Venkateswar Reddy Melachervu
> "...dare to dream, care to win..."
> www.linkedin.com/in/vmelachervu
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kjetil Nygård 2014-04-01 20:18:34 Timezone error when casting. Maybe daylight saving
Previous Message Venkateswar Reddy Melachervu 2014-03-30 06:47:21 Re: pgsql jdbc db connection weird behaviour