I'm working with postgresql 7.2.1 and want to leverage Large Objects in my Struts application using oid's. I have the typical struts-config.xml configuration specifying a connection pool with the postgresql driver. I'm using Struts 1.0.2.
According to the documentation for postgresql, I need to obtain direct access to the native postgresql Connection object to use its Large Object API, i.e.: LargeObjectManager lobjManager = ((org.postgresql.Connection)conn).getLargeObjectAPI(); However, the code below results in a ClassCastException on GenericConnection DataSource dataSource = servlet.findDataSource("pfdb"); Connection conn = dataSource.getConnection(); LargeObjectManager lobjManager = ((org.postgresql.Connection)conn).getLargeObjectAPI(); I read through the mailing list archives and came across a similar request by David Noll from back in 2001 where he wanted to use MySQL-specific features ( See http://nagoya.apache.org/eyebrowse/ReadMsg?listName=struts-user@jakarta. apache.org&msgId=143539 ). The reply to that message, from Matthius Bauer, explained, >>You must not cast GenericConnection to What you really want to do is call >>DataSource.getConnection which returns a Connection object like so: >> >> DataSource ds = getServlet().findDataSource(null); >> Connection con = ds.getConnection(); >> >>You can cast this connection to org.gjt.mm.mysql.Connection without any >>problems! So, this is what I did, but alas, to no avail -- the ClassCastException problem. No further responses were shown to illuminate a solution. Digging into the GenericDataSource and GenericDataConnection, it becomes clear that they are wrappers and do not expose the underlying Connection. What I would appear to need is the ability to cast my Connection to a GenericConnection, and then call getConnection(), and then cast that to the database-specific Connection. Unfortunately, GenericConnection.getConnection() has protected visibility. I don't see a way to extract the native Connection... but then again I'm 31 and have chicken pox and it's 3am on a work day. I'm about ready to extract the 1.0.2 source, change the visibility to public, and stick it back into struts.jar, but that seems a bit barbaric. Could someone point me in the right direction? Sincere thanks, Dan Rudman -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>