Hi,

Not sure if this is what your looking for but you should really close all
associations to the connection
cause I think that the way CMT works with orion is that the close method
merely returns it to the pool
so you should do the following before you close:

             stmt = conn.prepareStatement(sqlStatement);
              stmt.setString(1, websiteid);
              ResultSet rs = stmt.executeQuery();
              rs.next();
              siteEndDate = rs.getTimestamp(1);
              siteBeginDate = rs.getTimestamp(2);

// Here
                rs.close ();
                stmt.close ();

====>    conn.close();

This means that the connection is now free for the CMT to use again (I THINK
;)


john


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Marc Lehnert
Sent: 07 March 2002 15:56
To: Orion-Interest
Subject: JDBC connection leak


Hello!
I call the following code in a Message Driven Bean in Orion 1.5.2. After the
"conn.close()" all entity beans I created in some code before are destroyed.
The database is empty. The sql statement gets the right result but after the
close everything is lost. No error, nothing. Without the close statement
Orion says that there is a leaked connection and that I have to close it:
==
OrionCMTConnection not closed, check your code!
LogicalDriverManagerXAConnection not closed, check your code!
(Use -Djdbc.connection.debug=true to find out where the leaked connection
was created)
==

Can anybody help me?

Thanks in advance.

Marc Lehnert,.


The code:
====

            PreparedStatement stmt = null;
            java.sql.Timestamp siteEndDate;
            java.sql.Timestamp siteBeginDate;

            try {

              javax.sql.DataSource ds =
(javax.sql.DataSource)jndiContext.lookup("jdbc/sapdbDS");
              Connection conn = ds.getConnection();

              //Connection conn =
ConnectionFactory.getConnection("jdbc/sapdbDS");

              String sqlStatement = "select max(rw_datetime),
min(rw_datetime) from logfilerow where rw_websiteid = ?";

              stmt = conn.prepareStatement(sqlStatement);
              stmt.setString(1, websiteid);
              ResultSet rs = stmt.executeQuery();
              rs.next();
              siteEndDate = rs.getTimestamp(1);
              siteBeginDate = rs.getTimestamp(2);

====>    conn.close();

            } catch (Exception e) {
              e.printStackTrace();
              throw e;
            }



Reply via email to