I'm not sure but it seems more like a synchronization problem with the
Database Pool Servlet. Maybe the database connection isnt being released
back to the pool correctly. You may want to write your own Database
connection object and skip the pool. Test your servlet with that and see if
the problem goes. If it does then I guess you've isolated the problem to the
Database pooling.............

Amit Karandikar
4C Solutions, Inc.
Programmer / Analyst
Off  Phone: (309) 751 6196

                -----Original Message-----
                From:   Mark Wurm [mailto:[EMAIL PROTECTED]]
                Sent:   Thursday, March 11, 1999 3:12 PM
                To:     [EMAIL PROTECTED]
                Subject:        Servlets with Informix and LiveConnect

                I have a LiveConnect application (Enterprise Server 3.5.1
with JRUN 2.2
                running on HP-UX 10.20) which I would prefer not to rewrite
in its
                entirety.
                I need to implement some data manipulation processes that
are so easy
                to do in java. but which LiveConnect will not support.

                I reach a point in my application where I want to do a data
base lookup
                (Informix 9.14.UC3), so I invoke a redirect to a servlet.
That servlet
                calls a second servlet (database connection pool --
shamelessly similar
                to the one in Mr. Moss' terrific book) and retrieves a
connection. The
                first

                servlet uses the connection to perform the lookup,
manipulates the data,

                and creates an HTML page.  This all works great.  I was
amazed at how
                easy it was --- until . . .

                If I invoke two lookups at the same time, Informix gives me
an error on
                one
                of
                my connections that says there was a null pointer exception
on a blob
                type
                column, and that the error should never occur.  If the error
recurs, the

                message
                says, contact Informix support.  It does, and I did, but
they don't have
                an
                answer yet, so I'm posting this letter hoping someone has
encountered
                something similar.

                The process works fine with sequential requests, only
simultaneous
                requests fail.

                I separated my servlet invocation from the LiveConnect
application.  In
                the
                original code, I sent the servlet a fairly complex SQL query
as a
                string,
                so I just hard coded a query into the servlet and invoked it
from the
                URL
                line of my browser.  Same problem.

                Since only one column in the table was a blob, I thought
that might be
                masking
                some other issue.  I stopped fetching that column.  The
error changed to
                a
                267:
                  "The FREE statement released the resources that are
attached to the
                cursor named in this statement.  Before you can use the
cursor, you must

                again prepare the SQL statement that is associated with it.
If the
                cursor
                was declared FOR a statement, re-execute its DECLARE
statement.  If it
                was declared FOR a statement identifier, execute the PREPARE
statement
                again.

                Well, gee, I wasn't even using a PreparedStatement; I was
using a simple

                Statement.executeQuery(myQuery).  So I recoded the servlet
to use a
                PreparedStatement and, voila, the error went away. (I'm
using the
                intersolv
                class 4 jdbc driver level 1.22)  Then I reimplemented my
fetch of the
                blob
                column.  Continued success!

                Feeling really smart, I reassembled everything to use
LiveConnect again.

                The error returned.

                I think it sounds like a jdbc driver problem.  Informix is
checking into

                that.

                When LiveConnect does a redirect, I think LiveConnect should
be out
                of the picture, so I am baffled at what influence it can
have on the
                process.
                I was under the impression that the redirect was a request
for the doGet

                method of the servlet which is under JRUN's control.  JRUN
then
                interfaces
                between the java process and the httpd process, but only
insofar as
                the httpd process serves to send the output to the correct
client.
                True?
                False? Maybe?  Help!

                Mark


                --
                Mark R. Wurm
                312-424-3766


*******************************************************************


___________________________________________________________________________
                To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body
                of the message "signoff SERVLET-INTEREST".

                Archives:
http://archives.java.sun.com/archives/servlet-interest.html
                Resources:
http://java.sun.com/products/servlet/external-resources.html
                LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to