vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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.BasicDataSourceFact ory</value> </parameter> <parameter> <name>driverClassName</name> <value>org.postgresql.Driver</value> </parameter> <parameter> <name>url</name> <value>jdbc </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).get LargeObjectAPI(); I get the following error : java.lang.ClassCastException This is because the connection is an instance of org.apache.commons.dbcp.PoolingDataSource$PoolGuar dConnectionWrapper 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 |
| |||
| 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.BasicDataSourceFact ory</ > value> > </parameter> > <parameter> > <name>driverClassName</name> > <value>org.postgresql.Driver</value> > </parameter> > <parameter> > <name>url</name> > <value>jdbc > </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$PoolGuar dConnectionWrapper > 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 |
| ||||
| Marc, Here's some sample code: PGConnection pgCon = (PGConnection)((DelegatingConnection)con).getInner mostDelegate(); -- 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.BasicDataSourceFact ory</ > > value> > > </parameter> > > <parameter> > > <name>driverClassName</name> > > <value>org.postgresql.Driver</value> > > </parameter> > > <parameter> > > <name>url</name> > > <value>jdbc > > </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$PoolGuar dConnectionWrapper > > 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 |