pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedPGConnection (LargeObject) / JNDI Tomcat Issue
6+ messages / 4 participants
[nested] [flat]
* PGConnection (LargeObject) / JNDI Tomcat Issue
@ 2006-01-18 16:56 Marc SCHNEIDER <marco_2025@web.de>
2006-01-18 17:37 ` Re: PGConnection (LargeObject) / JNDI Tomcat Issue Dave Cramer <pg@fastcrypt.com>
2006-01-19 09:54 ` Re: PGConnection (LargeObject) / JNDI Tomcat Issue Marc SCHNEIDER <marco_2025@web.de>
0 siblings, 2 replies; 6+ messages in thread
From: Marc SCHNEIDER @ 2006-01-18 16:56 UTC (permalink / raw)
To: pgsql-jdbc
Hello,
I have trouble to get Tomcat and JDBC work with LargeObject.
I am using JNDI for database access
<Resource name="jdbc/aguila" auth="Container" type="java.sql.DataSource"/>
<ResourceParams name="jdbc/aguila">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.postgresql.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:postgresql://localhost:5432/intradev</value>
</parameter>
<parameter>
<name>username</name>
<value>myuser</value>
</parameter>
<parameter>
<name>password</name>
<value>mypass</value>
</parameter>
</ResourceParams>
Here is my code :
LargeObjectManager lom = ((org.postgresql.PGConnection)this.connection).getLargeObjectAPI();
I get the following error :
java.lang.ClassCastException
This is because the connection is an instance of org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper
and I'm trying to get a org.postgresql.PGConnection connection.
I saw on the web that people used org.postgresql.jdbc3.Jdbc3ObjectFactory but this class is available with jdbc 7.x drivers only.
I tried to use the org.postgresql.ds.common.PGObjectFactory class but when I connect to the database I get the following error :
"no PostgreSQL user name specified in startup packet"
Here is my config :
DB : PostgreSQL 8.0
Driver jdbc : postgresql-8.0-312.jdbc3.jar
Java Server : Tomcat 5.0.28
Os : Win XP
Any idea ???
Regards,
Marc SCHNEIDER.
__________________________________________________________________________
Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-Postfach!
Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: PGConnection (LargeObject) / JNDI Tomcat Issue
2006-01-18 16:56 PGConnection (LargeObject) / JNDI Tomcat Issue Marc SCHNEIDER <marco_2025@web.de>
@ 2006-01-18 17:37 ` Dave Cramer <pg@fastcrypt.com>
2006-01-18 19:13 ` Re: PGConnection (LargeObject) / JNDI Tomcat Issue Mark Lewis <mark.lewis@mir3.com>
1 sibling, 1 reply; 6+ messages in thread
From: Dave Cramer @ 2006-01-18 17:37 UTC (permalink / raw)
To: Marc SCHNEIDER <marco_2025@web.de>; +Cc: pgsql-jdbc
Marc,
Check dbcp's documentation, there is a way to get the underlying
connection.
You will have to first cast to some dbcp connection, then get the
connection and cast it.
Dave
On 18-Jan-06, at 11:56 AM, Marc SCHNEIDER wrote:
> Hello,
>
> I have trouble to get Tomcat and JDBC work with LargeObject.
>
> I am using JNDI for database access
>
> <Resource name="jdbc/aguila" auth="Container"
> type="java.sql.DataSource"/>
> <ResourceParams name="jdbc/aguila">
> <parameter>
> <name>factory</name>
> <value>org.apache.commons.dbcp.BasicDataSourceFactory</
> value>
> </parameter>
> <parameter>
> <name>driverClassName</name>
> <value>org.postgresql.Driver</value>
> </parameter>
> <parameter>
> <name>url</name>
> <value>jdbc:postgresql://localhost:5432/intradev</value>
> </parameter>
> <parameter>
> <name>username</name>
> <value>myuser</value>
> </parameter>
> <parameter>
> <name>password</name>
> <value>mypass</value>
> </parameter>
> </ResourceParams>
>
> Here is my code :
>
> LargeObjectManager lom = ((org.postgresql.PGConnection)
> this.connection).getLargeObjectAPI();
>
> I get the following error :
>
> java.lang.ClassCastException
> This is because the connection is an instance of
> org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper
> and I'm trying to get a org.postgresql.PGConnection connection.
>
> I saw on the web that people used
> org.postgresql.jdbc3.Jdbc3ObjectFactory but this class is available
> with jdbc 7.x drivers only.
>
> I tried to use the org.postgresql.ds.common.PGObjectFactory class
> but when I connect to the database I get the following error :
> "no PostgreSQL user name specified in startup packet"
>
> Here is my config :
> DB : PostgreSQL 8.0
> Driver jdbc : postgresql-8.0-312.jdbc3.jar
> Java Server : Tomcat 5.0.28
> Os : Win XP
>
> Any idea ???
>
> Regards,
> Marc SCHNEIDER.
> ______________________________________________________________________
> ____
> Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-
> Postfach!
> Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: PGConnection (LargeObject) / JNDI Tomcat Issue
2006-01-18 16:56 PGConnection (LargeObject) / JNDI Tomcat Issue Marc SCHNEIDER <marco_2025@web.de>
2006-01-18 17:37 ` Re: PGConnection (LargeObject) / JNDI Tomcat Issue Dave Cramer <pg@fastcrypt.com>
@ 2006-01-18 19:13 ` Mark Lewis <mark.lewis@mir3.com>
0 siblings, 0 replies; 6+ messages in thread
From: Mark Lewis @ 2006-01-18 19:13 UTC (permalink / raw)
To: Marc SCHNEIDER <marco_2025@web.de>; +Cc: pgsql-jdbc
Marc,
Here's some sample code:
PGConnection pgCon =
(PGConnection)((DelegatingConnection)con).getInnermostDelegate();
-- Mark Lewis
On Wed, 2006-01-18 at 12:37 -0500, Dave Cramer wrote:
> Marc,
>
> Check dbcp's documentation, there is a way to get the underlying
> connection.
>
> You will have to first cast to some dbcp connection, then get the
> connection and cast it.
>
> Dave
> On 18-Jan-06, at 11:56 AM, Marc SCHNEIDER wrote:
>
> > Hello,
> >
> > I have trouble to get Tomcat and JDBC work with LargeObject.
> >
> > I am using JNDI for database access
> >
> > <Resource name="jdbc/aguila" auth="Container"
> > type="java.sql.DataSource"/>
> > <ResourceParams name="jdbc/aguila">
> > <parameter>
> > <name>factory</name>
> > <value>org.apache.commons.dbcp.BasicDataSourceFactory</
> > value>
> > </parameter>
> > <parameter>
> > <name>driverClassName</name>
> > <value>org.postgresql.Driver</value>
> > </parameter>
> > <parameter>
> > <name>url</name>
> > <value>jdbc:postgresql://localhost:5432/intradev</value>
> > </parameter>
> > <parameter>
> > <name>username</name>
> > <value>myuser</value>
> > </parameter>
> > <parameter>
> > <name>password</name>
> > <value>mypass</value>
> > </parameter>
> > </ResourceParams>
> >
> > Here is my code :
> >
> > LargeObjectManager lom = ((org.postgresql.PGConnection)
> > this.connection).getLargeObjectAPI();
> >
> > I get the following error :
> >
> > java.lang.ClassCastException
> > This is because the connection is an instance of
> > org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper
> > and I'm trying to get a org.postgresql.PGConnection connection.
> >
> > I saw on the web that people used
> > org.postgresql.jdbc3.Jdbc3ObjectFactory but this class is available
> > with jdbc 7.x drivers only.
> >
> > I tried to use the org.postgresql.ds.common.PGObjectFactory class
> > but when I connect to the database I get the following error :
> > "no PostgreSQL user name specified in startup packet"
> >
> > Here is my config :
> > DB : PostgreSQL 8.0
> > Driver jdbc : postgresql-8.0-312.jdbc3.jar
> > Java Server : Tomcat 5.0.28
> > Os : Win XP
> >
> > Any idea ???
> >
> > Regards,
> > Marc SCHNEIDER.
> > ______________________________________________________________________
> > ____
> > Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-
> > Postfach!
> > Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131
> >
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 5: don't forget to increase your free space map settings
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: PGConnection (LargeObject) / JNDI Tomcat Issue
2006-01-18 16:56 PGConnection (LargeObject) / JNDI Tomcat Issue Marc SCHNEIDER <marco_2025@web.de>
@ 2006-01-19 09:54 ` Marc SCHNEIDER <marco_2025@web.de>
2016-05-02 18:55 ` Re: PGConnection (LargeObject) / JNDI Tomcat Issue peter.penzov <peter.penzov@gmail.com>
1 sibling, 1 reply; 6+ messages in thread
From: Marc SCHNEIDER @ 2006-01-19 09:54 UTC (permalink / raw)
To: pgsql-jdbc
"Marc SCHNEIDER" <marco_2025@web.de> schrieb am 19.01.06 10:52:49:
Hello,
Thank you for your answers, it really helps me.
So the solution with getInnermostDelegate() method works.
Just don't forget to put the dbcp property 'accessToUnderlyingConnectionAllowed' to true before.
But I will post another message with a different topic :
I wonder which class in the jdbc driver you can use if you want to replace the org.apache.commons.dbcp.BasicDataSourceFactory one.
Thank you,
Marc.
Mark Lewis <mark.lewis@mir3.com> schrieb am 18.01.06 20:14:03:
Marc,
Here's some sample code:
PGConnection pgCon =
(PGConnection)((DelegatingConnection)con).getInnermostDelegate();
-- Mark Lewis
On Wed, 2006-01-18 at 12:37 -0500, Dave Cramer wrote:
> Marc,
>
> Check dbcp's documentation, there is a way to get the underlying
> connection.
>
> You will have to first cast to some dbcp connection, then get the
> connection and cast it.
>
> Dave
> On 18-Jan-06, at 11:56 AM, Marc SCHNEIDER wrote:
>
> > Hello,
> >
> > I have trouble to get Tomcat and JDBC work with LargeObject.
> >
> > I am using JNDI for database access
> >
> > <Resource name="jdbc/aguila" auth="Container"
> > type="java.sql.DataSource"/>
> > <ResourceParams name="jdbc/aguila">
> > <parameter>
> > <name>factory</name>
> > <value>org.apache.commons.dbcp.BasicDataSourceFactory</
> > value>
> > </parameter>
> > <parameter>
> > <name>driverClassName</name>
> > <value>org.postgresql.Driver</value>
> > </parameter>
> > <parameter>
> > <name>url</name>
> > <value>jdbc:postgresql://localhost:5432/intradev</value>
> > </parameter>
> > <parameter>
> > <name>username</name>
> > <value>myuser</value>
> > </parameter>
> > <parameter>
> > <name>password</name>
> > <value>mypass</value>
> > </parameter>
> > </ResourceParams>
> >
> > Here is my code :
> >
> > LargeObjectManager lom = ((org.postgresql.PGConnection)
> > this.connection).getLargeObjectAPI();
> >
> > I get the following error :
> >
> > java.lang.ClassCastException
> > This is because the connection is an instance of
> > org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper
> > and I'm trying to get a org.postgresql.PGConnection connection.
> >
> > I saw on the web that people used
> > org.postgresql.jdbc3.Jdbc3ObjectFactory but this class is available
> > with jdbc 7.x drivers only.
> >
> > I tried to use the org.postgresql.ds.common.PGObjectFactory class
> > but when I connect to the database I get the following error :
> > "no PostgreSQL user name specified in startup packet"
> >
> > Here is my config :
> > DB : PostgreSQL 8.0
> > Driver jdbc : postgresql-8.0-312.jdbc3.jar
> > Java Server : Tomcat 5.0.28
> > Os : Win XP
> >
> > Any idea ???
> >
> > Regards,
> > Marc SCHNEIDER.
> > ______________________________________________________________________
> > ____
> > Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-
> > Postfach!
> > Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131
> >
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 5: don't forget to increase your free space map settings
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
__________________________________________________________________________
Erweitern Sie FreeMail zu einem noch leistungsstarkeren E-Mail-Postfach!
Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: PGConnection (LargeObject) / JNDI Tomcat Issue
2006-01-18 16:56 PGConnection (LargeObject) / JNDI Tomcat Issue Marc SCHNEIDER <marco_2025@web.de>
2006-01-19 09:54 ` Re: PGConnection (LargeObject) / JNDI Tomcat Issue Marc SCHNEIDER <marco_2025@web.de>
@ 2016-05-02 18:55 ` peter.penzov <peter.penzov@gmail.com>
2016-05-03 00:38 ` Re: PGConnection (LargeObject) / JNDI Tomcat Issue Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 6+ messages in thread
From: peter.penzov @ 2016-05-02 18:55 UTC (permalink / raw)
To: pgsql-jdbc
I have the same issue. I tried to use PGConnection pgCon
=(PGConnection)((DelegatingConnection)conn).getInnermostDelegate();
But I get
Caused by: java.lang.ClassCastException:
org.apache.tomcat.dbcp.dbcp2.PoolingDataSource$PoolGuardConnectionWrapper
cannot be cast to org.apache.commons.dbcp.DelegatingConnection
I use 9.2-1002.jdbc4 and Tomcat 8.
Can you propose some solution?
--
View this message in context: http://postgresql.nabble.com/PGConnection-LargeObject-JNDI-Tomcat-Issue-tp2169889p5901537.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: PGConnection (LargeObject) / JNDI Tomcat Issue
2006-01-18 16:56 PGConnection (LargeObject) / JNDI Tomcat Issue Marc SCHNEIDER <marco_2025@web.de>
2006-01-19 09:54 ` Re: PGConnection (LargeObject) / JNDI Tomcat Issue Marc SCHNEIDER <marco_2025@web.de>
2016-05-02 18:55 ` Re: PGConnection (LargeObject) / JNDI Tomcat Issue peter.penzov <peter.penzov@gmail.com>
@ 2016-05-03 00:38 ` Dave Cramer <pg@fastcrypt.com>
0 siblings, 0 replies; 6+ messages in thread
From: Dave Cramer @ 2016-05-03 00:38 UTC (permalink / raw)
To: peter.penzov <peter.penzov@gmail.com>; +Cc: pgsql-jdbc
I would suggest you use the latest driver to start with
Dave Cramer
davec@postgresintl.com
www.postgresintl.com
On 2 May 2016 at 14:55, peter.penzov <peter.penzov@gmail.com> wrote:
> I have the same issue. I tried to use PGConnection pgCon
> =(PGConnection)((DelegatingConnection)conn).getInnermostDelegate();
>
> But I get
>
> Caused by: java.lang.ClassCastException:
> org.apache.tomcat.dbcp.dbcp2.PoolingDataSource$PoolGuardConnectionWrapper
> cannot be cast to org.apache.commons.dbcp.DelegatingConnection
>
> I use 9.2-1002.jdbc4 and Tomcat 8.
>
> Can you propose some solution?
>
>
>
> --
> View this message in context:
> http://postgresql.nabble.com/PGConnection-LargeObject-JNDI-Tomcat-Issue-tp2169889p5901537.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
end of thread, other threads:[~2016-05-03 00:38 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-01-18 16:56 PGConnection (LargeObject) / JNDI Tomcat Issue Marc SCHNEIDER <marco_2025@web.de>
2006-01-18 17:37 ` Dave Cramer <pg@fastcrypt.com>
2006-01-18 19:13 ` Mark Lewis <mark.lewis@mir3.com>
2006-01-19 09:54 ` Marc SCHNEIDER <marco_2025@web.de>
2016-05-02 18:55 ` peter.penzov <peter.penzov@gmail.com>
2016-05-03 00:38 ` Dave Cramer <pg@fastcrypt.com>
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