You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Kevin HaleBoyes <kz...@yahoo.com> on 2003/02/11 16:07:41 UTC

[DBCP] getting the underlying result set for Blob processing

I'm using Tomcat 4.1.18 and the connection pooling (DBCP but I'm not
sure what version) that comes with it.  I've got a connection,
prepared a (select) statement and executed the query.  This always
works great but I've got a special case that I need to handle.

I'm trying to insert/update a Blob into an Oracle database.  All of
the literature says that I must cast my ResultSet to an
OracleResultSet and call the getBLOB() method (note: I'm not calling
the standard getBlob() method).  Given the Oracle BLOB (locator) I
can stream the contents to the database.

Now, the ResultSet that I'm getting from the stmt.executeQuery() call
is a DelegatingResultSet from the dbcp package and that can not be
casted into the (ultimately underlying) OracleResultSet.

I noticed that there is a method in DelegatingResultSet to get the
Statement but none to get the ResultSet.  If I could get the
contained ResultSet then I could do the cast.

Does anyone have any advice on how to proceed?
Thanks,
Kevin.

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

Re: [DBCP] getting the underlying result set for Blob processing

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 11 Feb 2003, Stephen Westbom wrote:

> Date: Tue, 11 Feb 2003 09:40:04 -0800 (PST)
> From: Stephen Westbom <sw...@yahoo.com>
> Reply-To: Jakarta Commons Users List <co...@jakarta.apache.org>
> To: Jakarta Commons Users List <co...@jakarta.apache.org>
> Subject: Re: [DBCP] getting the underlying result set for Blob processing
>
> Even better.  You have to love Oracle for tying you up in knots with their
> proprietary solutions.
>

Yep :-(.

Craig

> --- "Craig R. McClanahan" <cr...@apache.org> wrote:
> >
> >
> > On Tue, 11 Feb 2003, Stephen Westbom wrote:
> >
> > > Date: Tue, 11 Feb 2003 09:31:31 -0800 (PST)
> > > From: Stephen Westbom <sw...@yahoo.com>
> > > Reply-To: Jakarta Commons Users List <co...@jakarta.apache.org>
> > > To: Jakarta Commons Users List <co...@jakarta.apache.org>
> > > Subject: Re: [DBCP] getting the underlying result set for Blob processing
> > >
> > > Get the source code (you will need JUnit and Ant) and put a method in to
> > get
> > > the underlying result set (_res).  DelegatingResultSet is a Delegator or
> > > wrapper pattern class.  The underlying result set object is passed in
> > through
> > > the constructor and is private (nothing is exposed to get it).
> > >
> > > I have done things like this several times to overcome bugs in this code,
> > it is
> > > fairly easy to roll your own version of the jar file.
> > >
> >
> > The precise change you suggest was added to DelegatingResultSet subsequent
> > to the 1.0 release -- grab a recent nightly build and you can call the
> > getDelegate() method to get the underlying ResultSet that is being
> > wrapped.
> >
> >   http://jakarta.apache.org/builds/jakarta-commons/nightly/commons-dbcp
> >
> > > Good luck.
> >
> > Craig
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Shopping - Send Flowers for Valentine's Day
> http://shopping.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

Re: [DBCP] getting the underlying result set for Blob processing

Posted by Stephen Westbom <sw...@yahoo.com>.
Even better.  You have to love Oracle for tying you up in knots with their
proprietary solutions.

--- "Craig R. McClanahan" <cr...@apache.org> wrote:
> 
> 
> On Tue, 11 Feb 2003, Stephen Westbom wrote:
> 
> > Date: Tue, 11 Feb 2003 09:31:31 -0800 (PST)
> > From: Stephen Westbom <sw...@yahoo.com>
> > Reply-To: Jakarta Commons Users List <co...@jakarta.apache.org>
> > To: Jakarta Commons Users List <co...@jakarta.apache.org>
> > Subject: Re: [DBCP] getting the underlying result set for Blob processing
> >
> > Get the source code (you will need JUnit and Ant) and put a method in to
> get
> > the underlying result set (_res).  DelegatingResultSet is a Delegator or
> > wrapper pattern class.  The underlying result set object is passed in
> through
> > the constructor and is private (nothing is exposed to get it).
> >
> > I have done things like this several times to overcome bugs in this code,
> it is
> > fairly easy to roll your own version of the jar file.
> >
> 
> The precise change you suggest was added to DelegatingResultSet subsequent
> to the 1.0 release -- grab a recent nightly build and you can call the
> getDelegate() method to get the underlying ResultSet that is being
> wrapped.
> 
>   http://jakarta.apache.org/builds/jakarta-commons/nightly/commons-dbcp
> 
> > Good luck.
> 
> Craig
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

Re: [DBCP] getting the underlying result set for Blob processing

Posted by Rodney Waldhoff <rw...@apache.org>.
On Tue, 11 Feb 2003, Kevin HaleBoyes wrote:

>
> It is a real shame that I have to do this.  Not only is my webapp
> now dependant on Oracle it also has to know about
> DelegatingResultSet and that I'm using DBCP.  At least it's all
> tucked away into a DAO class and doesn't effect the rest of the
> application.
>
>

Agreed.  One way of minimizing the dependency on DBCP here is to use a
utility method like this:

public ResultSet toUnderlyingResultSet(ResultSet rset) {
  while(rset instanceof DelegatingResultSet) {
    rset = ((DelegatingResultSet)rset)).getDelegate();
  }
  return ResultSet;
}

and use it like:

OracleResultSet orset = (OracleResultSet)(toUnderlyingResultSet(rset));

(of course, you could embed the cast to Oracle in that method as well).

This will make DBCP a compile-time, but not a run-time, dependency, which
I would recommend (since a simple configuration change can turn pooling on
and off)

Re: [DBCP] getting the underlying result set for Blob processing

Posted by Stephen Westbom <sw...@yahoo.com>.
I would put them in the web app myself.  Here is the reasoning:

1.  You want to encapsulate an application so that it can be deployed to a
container without having to muck with the web container installation.  So when
you upgrade to the nth version of Tomcat or switch to Jetty or BEA, etc. you
will have less to test for and modify in a vanilla app server environment.

2.  You don't want to create cross web app dependencies.  This can make
upgrading the versions of the commons libs or jars in general a much bigger
investment in testing and logistics if you deploy to an environment with many
web applications on it.

3.  Your web apps are usually separate applications which usually means
different database connections will be used for them.  If they are shared
between applications by all means put it in common/lib.


--- Kevin HaleBoyes <kz...@yahoo.com> wrote:
> --- "Craig R. McClanahan" <cr...@apache.org> wrote:
> > 
> > In Tomcat the picture is slightly more complicated, because Tomcat
> > provides a couple of extra layers between system and webapp:
> > 
> >  
> >
> http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html
> > 
> > but the same principles apply.
> 
> Given this and the other information provided in this thread, I
> assume that I'd have to copy the commons-dbcp and commons-pool
> (provided by Struts and residing in MyWebApp/WEB-INF/lib) into the
> CATALINA_HOME/common/lib directory.  My reasoning is that it is
> Tomcat that is managing the connection pool and not the webapp, so
> any classes associated with dbcp are coming from common/lib.
> 
> Anyway, I've copied the two jar files and modified my code and
> everything is running great.
> 
> It is a real shame that I have to do this.  Not only is my webapp
> now dependant on Oracle it also has to know about
> DelegatingResultSet and that I'm using DBCP.  At least it's all
> tucked away into a DAO class and doesn't effect the rest of the
> application.
> 
> Many, many thanks to everyone that has helped.
> Not only has it helped me solve my immediate problem it has
> prompted me to re-read the class loader howto!
> Kevin.
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Shopping - Send Flowers for Valentine's Day
> http://shopping.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

Re: [DBCP] getting the underlying result set for Blob processing

Posted by Kevin HaleBoyes <kz...@yahoo.com>.
--- "Craig R. McClanahan" <cr...@apache.org> wrote:
> 
> In Tomcat the picture is slightly more complicated, because Tomcat
> provides a couple of extra layers between system and webapp:
> 
>  
>
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html
> 
> but the same principles apply.

Given this and the other information provided in this thread, I
assume that I'd have to copy the commons-dbcp and commons-pool
(provided by Struts and residing in MyWebApp/WEB-INF/lib) into the
CATALINA_HOME/common/lib directory.  My reasoning is that it is
Tomcat that is managing the connection pool and not the webapp, so
any classes associated with dbcp are coming from common/lib.

Anyway, I've copied the two jar files and modified my code and
everything is running great.

It is a real shame that I have to do this.  Not only is my webapp
now dependant on Oracle it also has to know about
DelegatingResultSet and that I'm using DBCP.  At least it's all
tucked away into a DAO class and doesn't effect the rest of the
application.

Many, many thanks to everyone that has helped.
Not only has it helped me solve my immediate problem it has
prompted me to re-read the class loader howto!
Kevin.


__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

Re: [DBCP] getting the underlying result set for Blob processing

Posted by Stephen Westbom <sw...@yahoo.com>.
Thanks, I knew it was somewhere. 


--- Erik Price <ep...@ptc.com> wrote:
> 
> 
> Stephen Westbom wrote:
> > There is a diagram of the hierarchy somewhere on the site, I couldn't find
> it
> > though.  Maybe it is in the distribution. 
> 
> There is one on this page:
> 
> http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html
> 
> 
> 
> 
> Erik
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

Re: [DBCP] getting the underlying result set for Blob processing

Posted by Stephen Westbom <sw...@yahoo.com>.
I was wrong on another count.  There is a divergence from the Java 2 standard
for the Servlet 2.3 recommendation mentioned in there that is important.  

Apparently the WebappX classloader looks in its local classpath first before
delegating up the hierarchy.  


--- Erik Price <ep...@ptc.com> wrote:
> 
> 
> Stephen Westbom wrote:
> > There is a diagram of the hierarchy somewhere on the site, I couldn't find
> it
> > though.  Maybe it is in the distribution. 
> 
> There is one on this page:
> 
> http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html
> 
> 
> 
> 
> Erik
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

Re: [DBCP] getting the underlying result set for Blob processing

Posted by Erik Price <ep...@ptc.com>.

Stephen Westbom wrote:
> There is a diagram of the hierarchy somewhere on the site, I couldn't find it
> though.  Maybe it is in the distribution. 

There is one on this page:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html




Erik


Re: [DBCP] getting the underlying result set for Blob processing

Posted by Stephen Westbom <sw...@yahoo.com>.
There is a diagram of the hierarchy somewhere on the site, I couldn't find it
though.  Maybe it is in the distribution. 


--- "Craig R. McClanahan" <cr...@apache.org> wrote:
> 
> 
> On Tue, 11 Feb 2003, Stephen Westbom wrote:
> 
> > Date: Tue, 11 Feb 2003 12:26:59 -0800 (PST)
> > From: Stephen Westbom <sw...@yahoo.com>
> > Reply-To: Jakarta Commons Users List <co...@jakarta.apache.org>
> > To: Jakarta Commons Users List <co...@jakarta.apache.org>
> > Subject: Re: [DBCP] getting the underlying result set for Blob processing
> >
> > Helpful class loader info.
> >
> > The common/lib jar is in the classpath of the system class loader (called
> after
> > the boostrap class loader based on your JVM's classpath).  The WEB-INF/lib
> has
> > an web application specific class loader (this is why applications can be
> > independent from each other within a web container).  The WAR's class
> loader is
> > a child node of the parent, the system class loader.
> >
> > A child class loader such as your WAR uses always defers class loading to
> the
> > parent, if the parent cannot find the class then the child tries on down
> the
> > chain.
> >
> > If you want the same versions of commons-dbcp and commons-pool to be used
> > across all applications within your Tomcat instance put them in common/lib
> > otherwise remove them from there and put them in the WEB-INF/lib directory
> as
> > part of your deployment.
> >
> > There can also be visibility issues between parent and child class loaders.
> > The parent class loader will not see child classes if they are not in its
> class
> > path, so a class loaded by a parent object using the parent's class loader
> may
> > try to load a class that only exists in the child class loader's class path
> and
> > not find it.  This is a fairly frequent problem for services.
> >
> > I hope this helps you understand the way class loaders work in web
> containers.
> > It should help when you run into this type of problem again (believe me you
> > will).
> >
> >                   Class loader hierarchy:
> >
> >                       boostrap (starts JVM)
> >                           |
> >                           |
> >                        system (classpath entries)
> >                          / \
> >                         /   \
> >                        /     \
> >                       webapp  webapp (WEB-INF/lib)
> >
> 
> In Tomcat the picture is slightly more complicated, because Tomcat
> provides a couple of extra layers between system and webapp:
> 
>   http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html
> 
> but the same principles apply.
> 
> >
> > --- Kevin HaleBoyes <kz...@yahoo.com> wrote:
> > > --- "Craig R. McClanahan" <cr...@apache.org> wrote:
> > > >
> > > > Struts 1.1b3 already has the patched version of DelegatingResultSet
> > > > in it.
> > > > I would put copy both commons-dbcp and commons-pool to make sure
> > > > they are
> > > > in synch, although I don't anticipate problems.
> > >
> > > Just to make sure I understand correctly.  Take the commons-dbcp and
> > > commons-pool from the Struts 1.1b3 (already in my WEB-INF/lib
> > > directory) and copy them to CATALINA_HOME/common/lib.
> > >
> 
> Yes.  My suggestion is that if update one, update 'em both.
> 
> > > Thanks,
> > > Kevin.
> 
> Craig
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

Re: [DBCP] getting the underlying result set for Blob processing

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 11 Feb 2003, Stephen Westbom wrote:

> Date: Tue, 11 Feb 2003 12:26:59 -0800 (PST)
> From: Stephen Westbom <sw...@yahoo.com>
> Reply-To: Jakarta Commons Users List <co...@jakarta.apache.org>
> To: Jakarta Commons Users List <co...@jakarta.apache.org>
> Subject: Re: [DBCP] getting the underlying result set for Blob processing
>
> Helpful class loader info.
>
> The common/lib jar is in the classpath of the system class loader (called after
> the boostrap class loader based on your JVM's classpath).  The WEB-INF/lib has
> an web application specific class loader (this is why applications can be
> independent from each other within a web container).  The WAR's class loader is
> a child node of the parent, the system class loader.
>
> A child class loader such as your WAR uses always defers class loading to the
> parent, if the parent cannot find the class then the child tries on down the
> chain.
>
> If you want the same versions of commons-dbcp and commons-pool to be used
> across all applications within your Tomcat instance put them in common/lib
> otherwise remove them from there and put them in the WEB-INF/lib directory as
> part of your deployment.
>
> There can also be visibility issues between parent and child class loaders.
> The parent class loader will not see child classes if they are not in its class
> path, so a class loaded by a parent object using the parent's class loader may
> try to load a class that only exists in the child class loader's class path and
> not find it.  This is a fairly frequent problem for services.
>
> I hope this helps you understand the way class loaders work in web containers.
> It should help when you run into this type of problem again (believe me you
> will).
>
>                   Class loader hierarchy:
>
>                       boostrap (starts JVM)
>                           |
>                           |
>                        system (classpath entries)
>                          / \
>                         /   \
>                        /     \
>                       webapp  webapp (WEB-INF/lib)
>

In Tomcat the picture is slightly more complicated, because Tomcat
provides a couple of extra layers between system and webapp:

  http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html

but the same principles apply.

>
> --- Kevin HaleBoyes <kz...@yahoo.com> wrote:
> > --- "Craig R. McClanahan" <cr...@apache.org> wrote:
> > >
> > > Struts 1.1b3 already has the patched version of DelegatingResultSet
> > > in it.
> > > I would put copy both commons-dbcp and commons-pool to make sure
> > > they are
> > > in synch, although I don't anticipate problems.
> >
> > Just to make sure I understand correctly.  Take the commons-dbcp and
> > commons-pool from the Struts 1.1b3 (already in my WEB-INF/lib
> > directory) and copy them to CATALINA_HOME/common/lib.
> >

Yes.  My suggestion is that if update one, update 'em both.

> > Thanks,
> > Kevin.

Craig

Re: [DBCP] getting the underlying result set for Blob processing

Posted by Stephen Westbom <sw...@yahoo.com>.
Helpful class loader info.

The common/lib jar is in the classpath of the system class loader (called after
the boostrap class loader based on your JVM's classpath).  The WEB-INF/lib has
an web application specific class loader (this is why applications can be
independent from each other within a web container).  The WAR's class loader is
a child node of the parent, the system class loader.  

A child class loader such as your WAR uses always defers class loading to the
parent, if the parent cannot find the class then the child tries on down the
chain.

If you want the same versions of commons-dbcp and commons-pool to be used
across all applications within your Tomcat instance put them in common/lib
otherwise remove them from there and put them in the WEB-INF/lib directory as
part of your deployment.

There can also be visibility issues between parent and child class loaders. 
The parent class loader will not see child classes if they are not in its class
path, so a class loaded by a parent object using the parent's class loader may
try to load a class that only exists in the child class loader's class path and
not find it.  This is a fairly frequent problem for services.

I hope this helps you understand the way class loaders work in web containers. 
It should help when you run into this type of problem again (believe me you
will).

                  Class loader hierarchy:

                      boostrap (starts JVM)
                          |
                          |
                       system (classpath entries)
                         / \
                        /   \
                       /     \
                      webapp  webapp (WEB-INF/lib)


--- Kevin HaleBoyes <kz...@yahoo.com> wrote:
> --- "Craig R. McClanahan" <cr...@apache.org> wrote:
> >
> > Struts 1.1b3 already has the patched version of DelegatingResultSet
> > in it.
> > I would put copy both commons-dbcp and commons-pool to make sure
> > they are
> > in synch, although I don't anticipate problems.
> 
> Just to make sure I understand correctly.  Take the commons-dbcp and
> commons-pool from the Struts 1.1b3 (already in my WEB-INF/lib
> directory) and copy them to CATALINA_HOME/common/lib.
> 
> Thanks,
> Kevin.
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Shopping - Send Flowers for Valentine's Day
> http://shopping.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

Re: [DBCP] getting the underlying result set for Blob processing

Posted by Stephen Westbom <sw...@yahoo.com>.
Helpful class loader info.

The common/lib jar is in the classpath of the system class loader (called after
the boostrap class loader based on your JVM's classpath.  The WEB-INF/lib has
an application specific class loader (this is why applications can be
independent from each other within a web container).  The WAR's class loader is
a child node of the parent, the system class loader.  

A child class loader such as your WAR uses always defers class loading to the
parent, if the parent cannot find the class then the child tries on down the
chain.

If you want the same versions of commons-dbcp and commons-pool to be used
across all applications within your Tomcat instance put them in common/lib
otherwise remove them from there and put them in the WEB-INF/lib directory as
part of your deployment.

There can also be visibility issues between parent and child class loaders. 
The parent class loader will not see child classes if they are not in its class
path, so a class loaded by a parent object using the parent's class loader may
try to load a class that only exists in the child class loader's class path and
not find it.  This is a fairly frequent problem for services.

I hope this helps you understand the way class loaders work in web containers. 
It should help when you run into this type of problem again (believe me you
will).




--- Kevin HaleBoyes <kz...@yahoo.com> wrote:
> --- "Craig R. McClanahan" <cr...@apache.org> wrote:
> >
> > Struts 1.1b3 already has the patched version of DelegatingResultSet
> > in it.
> > I would put copy both commons-dbcp and commons-pool to make sure
> > they are
> > in synch, although I don't anticipate problems.
> 
> Just to make sure I understand correctly.  Take the commons-dbcp and
> commons-pool from the Struts 1.1b3 (already in my WEB-INF/lib
> directory) and copy them to CATALINA_HOME/common/lib.
> 
> Thanks,
> Kevin.
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Shopping - Send Flowers for Valentine's Day
> http://shopping.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

Re: [DBCP] getting the underlying result set for Blob processing

Posted by Kevin HaleBoyes <kz...@yahoo.com>.
--- "Craig R. McClanahan" <cr...@apache.org> wrote:
>
> Struts 1.1b3 already has the patched version of DelegatingResultSet
> in it.
> I would put copy both commons-dbcp and commons-pool to make sure
> they are
> in synch, although I don't anticipate problems.

Just to make sure I understand correctly.  Take the commons-dbcp and
commons-pool from the Struts 1.1b3 (already in my WEB-INF/lib
directory) and copy them to CATALINA_HOME/common/lib.

Thanks,
Kevin.


__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

Re: [DBCP] getting the underlying result set for Blob processing

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 11 Feb 2003, Kevin HaleBoyes wrote:

>
> Craig, can I take the nightly build of commons-dbcp and drop it into
> my installation?  I'm using Tomcat 4.1.18 and Struts 1.1b3 so I have
> the commons-dbcp.jar in CATALINA_HOME/common/lib (provided as part
> of Tomcat) and in MyWebApp/WEB-INF/lib (provided as part of the
> Struts libraries).  I'm not using the datasource facility of Struts
> - only in Tomcat.  Should I replace both copies or is it enough to
> replace only the CATALINA_HOME/common/lib jar file?
>

Struts 1.1b3 already has the patched version of DelegatingResultSet in it.
I would put copy both commons-dbcp and commons-pool to make sure they are
in synch, although I don't anticipate problems.

> Again, thanks for the help.
> Kevin.
>

Craig

Re: [DBCP] getting the underlying result set for Blob processing

Posted by Kevin HaleBoyes <kz...@yahoo.com>.
--- "Craig R. McClanahan" <cr...@apache.org> wrote:
> 
> 
> On Tue, 11 Feb 2003, Stephen Westbom wrote:
> 
> > Date: Tue, 11 Feb 2003 09:31:31 -0800 (PST)
> > From: Stephen Westbom <sw...@yahoo.com>
> > Reply-To: Jakarta Commons Users List
> <co...@jakarta.apache.org>
> > To: Jakarta Commons Users List <co...@jakarta.apache.org>
> > Subject: Re: [DBCP] getting the underlying result set for Blob
> processing
> >
> > Get the source code (you will need JUnit and Ant) and put a
> method in to get
> > the underlying result set (_res).  DelegatingResultSet is a
> Delegator or
> > wrapper pattern class.  The underlying result set object is
> passed in through
> > the constructor and is private (nothing is exposed to get it).
> >
> > I have done things like this several times to overcome bugs in
> this code, it is
> > fairly easy to roll your own version of the jar file.
> >
> 
> The precise change you suggest was added to DelegatingResultSet
> subsequent
> to the 1.0 release -- grab a recent nightly build and you can call
> the
> getDelegate() method to get the underlying ResultSet that is being
> wrapped.
> 
>  
>
http://jakarta.apache.org/builds/jakarta-commons/nightly/commons-dbcp
> 
> > Good luck.
> 
> Craig

Thanks to Craig and Stephen for their advice!!

I have to agree with Stephen about the mess that Oracle forces us
to go through to handle blobs.  Given that the standard JDBC
interface
allows for blob handling, it is even more criminal.

Craig, can I take the nightly build of commons-dbcp and drop it into
my installation?  I'm using Tomcat 4.1.18 and Struts 1.1b3 so I have
the commons-dbcp.jar in CATALINA_HOME/common/lib (provided as part
of Tomcat) and in MyWebApp/WEB-INF/lib (provided as part of the
Struts libraries).  I'm not using the datasource facility of Struts
- only in Tomcat.  Should I replace both copies or is it enough to
replace only the CATALINA_HOME/common/lib jar file?

Again, thanks for the help.
Kevin.


__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

Re: [DBCP] getting the underlying result set for Blob processing

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 11 Feb 2003, Stephen Westbom wrote:

> Date: Tue, 11 Feb 2003 09:31:31 -0800 (PST)
> From: Stephen Westbom <sw...@yahoo.com>
> Reply-To: Jakarta Commons Users List <co...@jakarta.apache.org>
> To: Jakarta Commons Users List <co...@jakarta.apache.org>
> Subject: Re: [DBCP] getting the underlying result set for Blob processing
>
> Get the source code (you will need JUnit and Ant) and put a method in to get
> the underlying result set (_res).  DelegatingResultSet is a Delegator or
> wrapper pattern class.  The underlying result set object is passed in through
> the constructor and is private (nothing is exposed to get it).
>
> I have done things like this several times to overcome bugs in this code, it is
> fairly easy to roll your own version of the jar file.
>

The precise change you suggest was added to DelegatingResultSet subsequent
to the 1.0 release -- grab a recent nightly build and you can call the
getDelegate() method to get the underlying ResultSet that is being
wrapped.

  http://jakarta.apache.org/builds/jakarta-commons/nightly/commons-dbcp

> Good luck.

Craig

Re: [DBCP] getting the underlying result set for Blob processing

Posted by Stephen Westbom <sw...@yahoo.com>.
Get the source code (you will need JUnit and Ant) and put a method in to get
the underlying result set (_res).  DelegatingResultSet is a Delegator or
wrapper pattern class.  The underlying result set object is passed in through
the constructor and is private (nothing is exposed to get it).

I have done things like this several times to overcome bugs in this code, it is
fairly easy to roll your own version of the jar file.  

Good luck.


--- Kevin HaleBoyes <kz...@yahoo.com> wrote:
> I'm using Tomcat 4.1.18 and the connection pooling (DBCP but I'm not
> sure what version) that comes with it.  I've got a connection,
> prepared a (select) statement and executed the query.  This always
> works great but I've got a special case that I need to handle.
> 
> I'm trying to insert/update a Blob into an Oracle database.  All of
> the literature says that I must cast my ResultSet to an
> OracleResultSet and call the getBLOB() method (note: I'm not calling
> the standard getBlob() method).  Given the Oracle BLOB (locator) I
> can stream the contents to the database.
> 
> Now, the ResultSet that I'm getting from the stmt.executeQuery() call
> is a DelegatingResultSet from the dbcp package and that can not be
> casted into the (ultimately underlying) OracleResultSet.
> 
> I noticed that there is a method in DelegatingResultSet to get the
> Statement but none to get the ResultSet.  If I could get the
> contained ResultSet then I could do the cast.
> 
> Does anyone have any advice on how to proceed?
> Thanks,
> Kevin.
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Shopping - Send Flowers for Valentine's Day
> http://shopping.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com