Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

jconn5.5 close statement automatically?

14 views
Skip to first unread message

Kevin Chen

unread,
Mar 8, 2002, 3:07:27 PM3/8/02
to
Does jconn5.5 close statement automatically from time to time? I found the
following post in weblogic's newsgroup (the message is 2 years old) and I'm
having similar problem with the lastest jconn. I'm doing:

Statement query = getConnection().createStatement();
ResultSet resultSet = query.executeQuery( sql );
List states = readResultSet(resultSet);
query.close(); //always throw me a JZ0S2 exception

Here is the post from weblogic newsgroup:
----------------------------------------------------------------------------
-----------------------------------------------------------
Subject: Re: PROBLEM: java.sql.SQLException: JZ0S2: Statement object has
already been closed.
Date: Wed, 08 Mar 2000 10:49:01 -0800
From: Joseph Weinstein <j...@weblogic.com>
Newsgroup: weblogic.developer.interest.ejb,weblogic.developer.interest.jdbc
Hi Christian. I think I know the issue.
Our pooling system keeps track of any statement and result set objects
obtained by the client, and at closing time, when we are returning the
connection to the pool, as a part of general cleanup, we will close any
result sets and statements that the prior user did not. This is very
important from some DBMSes and some drivers, because DBMS and Java resources
may continue to accrue with the long-living pool connection if all these
subordinate objects are not closed. I believe:

1 - There is a bug in the jConnect driver such that in some case, the driver
will close a statement automatically, even though the client has not closed
it. When we do our cleanup we are getting an exception closing this
already-closed statement. 2 - Your code is in some case, not closing all
your statement objects when you're done with them, and the driver is doing
this automaitcally some time between when you're finished with a statement,
and we try to clean up after you close the connection.

Would you check your code, and if possible ensure that all statements are
closed asap? I believe the driver exception will go away if you do this. Let
me know... Joe

Christian...@itech.se wrote:


J

unread,
Mar 8, 2002, 7:59:55 PM3/8/02
to
On Fri, 8 Mar 2002 15:07:27 -0500, "Kevin Chen"
<kevin...@air2web.com> wrote:

Did you print your exception? Was it identical to the one discussed
here.

I searched cover letters for a bug like this but I did not find one.
Maybe if you had a specific bug reference vs. the comment more could
be learned.

Did you try enabling any Sybase tracing or any Weblogic tracing to
understand the sequence of events? Does readResultSet() read all
possible resultSets (could there be more than one?).

J

Kevin Chen

unread,
Mar 11, 2002, 4:44:08 PM3/11/02
to
The exception I got is:

DriverManager.getConnection("jdbc:weblogic:jts:corePool")

trying
driver[className=com.sybase.jdbc2.jdbc.SybDriver,com.sybase.jdbc2.jdbc.SybDr
iver@78077d]

trying
driver[className=weblogic.jdbc.jts.Driver,weblogic.jdbc.jts.Driver@69f996]

getConnection returning
driver[className=weblogic.jdbc.jts.Driver,weblogic.jdbc.jts.Driver@69f996]

java.sql.SQLException: Connection has already been closed.

at weblogic.jdbc.pool.Connection.checkIfClosed(Connection.java:56)

at weblogic.jdbc.pool.Statement.close(Statement.java:114)

at
com.air2web.platform.biz.device.handler.browser.MyServlet.service(MyServlet.
java:75)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:265)

at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:200)

at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:2456)

at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:2039)

at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)


Could this be related to meta data system objects? I'm getting JZ0SJ error
as well (even though I have jcatalog.sql ran. And plus ASA 8.0 by default
install all the jConnect 5.5 system objects)

java.sql.SQLException: JZ0SJ: Metadata accessor information was not found on
this database. Please install the required tables as mentioned in the
jConnect documentation.

at com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(ErrorMessage.java:498)

at
com.sybase.jdbc2.jdbc.MdaManager.getMetaDataAccessor(MdaManager.java:338)

at
com.sybase.jdbc2.jdbc.MdaManager.getMetaDataAccessor(MdaManager.java:311)

at
com.sybase.jdbc2.jdbc.MdaManager.getMetaDataAccessor(MdaManager.java:302)

at
com.sybase.jdbc2.jdbc.MdaManager.getMaxLongvarbinaryLength(MdaManager.java:5
12)

at com.sybase.jdbc2.tds.Tds.getMaxLongvarbinaryLength(Tds.java:3146)

at com.sybase.jdbc2.tds.TdsParam.sendingLongbinIsOK(TdsParam.java:914)

at com.sybase.jdbc2.tds.TdsParam.prepareForSend(TdsParam.java:401)

at com.sybase.jdbc2.jdbc.ParamManager.checkParams(ParamManager.java:592)

at com.sybase.jdbc2.tds.Tds.language(Tds.java:611)

at com.sybase.jdbc2.jdbc.SybStatement.sendQuery(SybStatement.java:1422)

at
com.sybase.jdbc2.jdbc.SybPreparedStatement.sendQuery(SybPreparedStatement.ja
va:1019)

at com.sybase.jdbc2.jdbc.SybStatement.execute(SybStatement.java:1658)

at
com.sybase.jdbc2.jdbc.SybPreparedStatement.execute(SybPreparedStatement.java
:580)

at weblogic.jdbc.pool.Statement.execute(Statement.java:264)


Thanks,
Kevin

"J" <j@bogusEmailAddress> wrote in message
news:3c895c4b...@forums.sybase.com...

J

unread,
Mar 12, 2002, 12:40:27 PM3/12/02
to
On Mon, 11 Mar 2002 16:44:08 -0500, "Kevin Chen"
<kevin...@air2web.com> wrote:

Sorry don't know much about ASA and its metadata but I would install
it and see if the problem goes away or pursue the metadata problem
separately as it is sure to cause other problems.

J

situ

unread,
Mar 20, 2002, 6:05:58 PM3/20/02
to
Hi,

My environment:
- Weblogic 5.1
- jConnect 5.2 connecting thru Sybase Direct Connect gateway to IBM
DB2 on mainframe (Note that Sybase Direct Connect simulates a Sybase
DB, so effectively we're talking in terms of "jConnect 5.2 connecting
to Sybase").

We have a web site working on this environment.

I get a similar exception as the one detailed in the first post:


java.sql.SQLException: Connection has already been closed.

at weblogic.jdbcbase.pool.Connection.checkIfClosed(Connection.java:39)
at weblogic.jdbc20.pool.Connection.createStatement(Connection.java:31)
at com.app.data.common.DefaultRDBMSStrategy.executeSelect(DefaultRDBMSStrategy.java:428)

What basically happens is that the connection seems to be getting
closed after a particular SQL is executed - WITHOUT my issueing a
connection.close() statement. Thereafter, the rest of the statements
within that transaction do not get executed, as the connection is
obviously closed.

This does not happen all the time, but happens on a very random basis;
so the same page works sometimes and doesnt work at other times. The
database and gateway are very stable.

Any help/feedback would be useful.

Thanks,
situ

0 new messages