pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql jdbc db connection weird behaviour
6+ messages / 5 participants
[nested] [flat]
* pgsql jdbc db connection weird behaviour
@ 2014-03-30 05:10 Venkateswar Reddy Melachervu <vmelachervu@gmail.com>
2014-03-30 05:29 ` Re: pgsql jdbc db connection weird behaviour Steven Schlansker <stevenschlansker@gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Venkateswar Reddy Melachervu @ 2014-03-30 05:10 UTC (permalink / raw)
To: pgsql-jdbc
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*
*Gotcha*
Weird enough, if I do not use a pooled connection but create a single db
stand-alone connection in the java code - dbCon = .getConnection(...) and
cast this to org.postgresql.PGConnection - to my surprise - it's
successful. Feels weird!
*Environment*
OS : WIndows 8 x64
JRE : java version "1.7.0_51"
Tomcat : 8.0 (x64)
Connection pooling : Tomcat jdbc connection pooling with database as JDBC
resource (org.apache.tomcat.jdbc.pool.DataSourceFactory)
PostgreSQL server : v9.3 x64
Pgsql JDBC version : JDBC41 Postgresql Driver, Version
9.3-1101<http://jdbc.postgresql.org/download/postgresql-9.3-1101.jdbc41.jar;
(stored
in Tomcat lib dir and linked from there to my project)
--
Regards,
Venkateswar Reddy Melachervu
"...dare to dream, care to win..."
www.linkedin.com/in/vmelachervu
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgsql jdbc db connection weird behaviour
2014-03-30 05:10 pgsql jdbc db connection weird behaviour Venkateswar Reddy Melachervu <vmelachervu@gmail.com>
@ 2014-03-30 05:29 ` Steven Schlansker <stevenschlansker@gmail.com>
2014-03-30 06:47 ` Re: pgsql jdbc db connection weird behaviour Venkateswar Reddy Melachervu <vmelachervu@gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Steven Schlansker @ 2014-03-30 05:29 UTC (permalink / raw)
To: Venkateswar Reddy Melachervu <vmelachervu@gmail.com>; +Cc: pgsql-jdbc
On Mar 30, 2014, at 12:10 AM, Venkateswar Reddy Melachervu <vmelachervu@gmail.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
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgsql jdbc db connection weird behaviour
2014-03-30 05:10 pgsql jdbc db connection weird behaviour Venkateswar Reddy Melachervu <vmelachervu@gmail.com>
2014-03-30 05:29 ` Re: pgsql jdbc db connection weird behaviour Steven Schlansker <stevenschlansker@gmail.com>
@ 2014-03-30 06:47 ` Venkateswar Reddy Melachervu <vmelachervu@gmail.com>
2014-03-31 12:38 ` Re: pgsql jdbc db connection weird behaviour Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 6+ messages in thread
From: Venkateswar Reddy Melachervu @ 2014-03-30 06:47 UTC (permalink / raw)
To: Steven Schlansker <stevenschlansker@gmail.com>; +Cc: pgsql-jdbc
Steve,
I've checked it - appears no duplicate jdbc drivers..:-(
On Sun, Mar 30, 2014 at 10:59 AM, Steven Schlansker <
stevenschlansker@gmail.com> wrote:
>
> On Mar 30, 2014, at 12:10 AM, Venkateswar Reddy Melachervu <
> vmelachervu@gmail.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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgsql jdbc db connection weird behaviour
2014-03-30 05:10 pgsql jdbc db connection weird behaviour Venkateswar Reddy Melachervu <vmelachervu@gmail.com>
2014-03-30 05:29 ` Re: pgsql jdbc db connection weird behaviour Steven Schlansker <stevenschlansker@gmail.com>
2014-03-30 06:47 ` Re: pgsql jdbc db connection weird behaviour Venkateswar Reddy Melachervu <vmelachervu@gmail.com>
@ 2014-03-31 12:38 ` Dave Cramer <pg@fastcrypt.com>
2016-05-02 19:30 ` Re: pgsql jdbc db connection weird behaviour peter.penzov <peter.penzov@gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Dave Cramer @ 2014-03-31 12:38 UTC (permalink / raw)
To: Venkateswar Reddy Melachervu <vmelachervu@gmail.com>; +Cc: Steven Schlansker <stevenschlansker@gmail.com>; 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@gmail.com> wrote:
> Steve,
> I've checked it - appears no duplicate jdbc drivers..:-(
>
>
> On Sun, Mar 30, 2014 at 10:59 AM, Steven Schlansker <
> stevenschlansker@gmail.com> wrote:
>
>>
>> On Mar 30, 2014, at 12:10 AM, Venkateswar Reddy Melachervu <
>> vmelachervu@gmail.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
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgsql jdbc db connection weird behaviour
2014-03-30 05:10 pgsql jdbc db connection weird behaviour Venkateswar Reddy Melachervu <vmelachervu@gmail.com>
2014-03-30 05:29 ` Re: pgsql jdbc db connection weird behaviour Steven Schlansker <stevenschlansker@gmail.com>
2014-03-30 06:47 ` Re: pgsql jdbc db connection weird behaviour Venkateswar Reddy Melachervu <vmelachervu@gmail.com>
2014-03-31 12:38 ` Re: pgsql jdbc db connection weird behaviour Dave Cramer <pg@fastcrypt.com>
@ 2016-05-02 19:30 ` peter.penzov <peter.penzov@gmail.com>
2016-05-03 01:48 ` Re: pgsql jdbc db connection weird behaviour Gavin Flower <GavinFlower@archidevsys.co.nz>
0 siblings, 1 reply; 6+ messages in thread
From: peter.penzov @ 2016-05-02 19:30 UTC (permalink / raw)
To: pgsql-jdbc
Hi All,
I have the same problem. Did you managed to solve it? Can you give some
advice?
--
View this message in context: http://postgresql.nabble.com/pgsql-jdbc-db-connection-weird-behaviour-tp5797924p5901547.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgsql jdbc db connection weird behaviour
2014-03-30 05:10 pgsql jdbc db connection weird behaviour Venkateswar Reddy Melachervu <vmelachervu@gmail.com>
2014-03-30 05:29 ` Re: pgsql jdbc db connection weird behaviour Steven Schlansker <stevenschlansker@gmail.com>
2014-03-30 06:47 ` Re: pgsql jdbc db connection weird behaviour Venkateswar Reddy Melachervu <vmelachervu@gmail.com>
2014-03-31 12:38 ` Re: pgsql jdbc db connection weird behaviour Dave Cramer <pg@fastcrypt.com>
2016-05-02 19:30 ` Re: pgsql jdbc db connection weird behaviour peter.penzov <peter.penzov@gmail.com>
@ 2016-05-03 01:48 ` Gavin Flower <GavinFlower@archidevsys.co.nz>
0 siblings, 0 replies; 6+ messages in thread
From: Gavin Flower @ 2016-05-03 01:48 UTC (permalink / raw)
To: peter.penzov <peter.penzov@gmail.com>; pgsql-jdbc
On 03/05/16 07:30, peter.penzov wrote:
> Hi All,
> I have the same problem. Did you managed to solve it? Can you give some
> advice?
>
>
>
> --
> View this message in context: http://postgresql.nabble.com/pgsql-jdbc-db-connection-weird-behaviour-tp5797924p5901547.html
> Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.
>
>
Hi Peter,
It is a very good idea to quote the relevant part of the email you are
referring to, as others may have had the same problem, but your email is
insufficient to identify the problem - referring to another web site is
bad etiquette (except when the other web site is the topic!).
Cheers,
Gavin
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2016-05-03 01:48 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-03-30 05:10 pgsql jdbc db connection weird behaviour Venkateswar Reddy Melachervu <vmelachervu@gmail.com>
2014-03-30 05:29 ` Steven Schlansker <stevenschlansker@gmail.com>
2014-03-30 06:47 ` Venkateswar Reddy Melachervu <vmelachervu@gmail.com>
2014-03-31 12:38 ` Dave Cramer <pg@fastcrypt.com>
2016-05-02 19:30 ` peter.penzov <peter.penzov@gmail.com>
2016-05-03 01:48 ` Gavin Flower <GavinFlower@archidevsys.co.nz>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox