Re: java.sql.sqlException closed statement
From: sunilthumma (sunilthumma_at_hotmail.com)
Date: 08/11/04
- Previous message: Shanmuhanathan T: "Re: Help with jdbc install please. Oracle 817 on XP"
- Next in thread: sunilthumma: "Re: java.sql.sqlException closed statement"
- Maybe reply: sunilthumma: "Re: java.sql.sqlException closed statement"
- Reply: Robert Klemme: "Re: java.sql.sqlException closed statement"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 11 Aug 2004 11:24:31 -0400
Hi,
I am getting this Closed Statement exception intermittently.
I am using prepared statement for multiple inserts in a loop.
Using Weblogic 7.4 App server & Oracle 9i db.
Here is the sample code i am using
Connection con = null;
PreparedStatement ps = null;
int result = 0;
try {
con = getConnection();
con.setAutoCommit(false);
ps = con.prepareStatement("INSERT INTO
AUDIT(USER_ID,FIRST_NAME,LAST_NAME,CODE) VALUES(?,?,?,?)");
if(eCodes != null) {
for(int i=0;i < eCodes.length;i++) {
try {
ps.setString(1,user.getUserId());
ps.setString(2,user.getFirstName());
ps.setString(3,user.getLastName());
ps.setString(5,eCodes[i].getCode());
result = executeUpdate(ps);
} catch(SQLException e) {
// here the Closed Statement exception is coming
logger.error("[logUserActivity] error : "+ e.toString());
} finally {
// if (ps != null)
// closeStatement(ps);
}
}
con.commit();
}
} catch(SQLException e) {
logger.error("[logUserActivity] error : "+ e.toString());
} finally {
if (ps != null)
closeStatement(ps);
if (con != null)
closeConnection(con);
}
Am I doing any mistake here ?
Any help will be appreciated !!
Thanks
-Sunil
- Previous message: Shanmuhanathan T: "Re: Help with jdbc install please. Oracle 817 on XP"
- Next in thread: sunilthumma: "Re: java.sql.sqlException closed statement"
- Maybe reply: sunilthumma: "Re: java.sql.sqlException closed statement"
- Reply: Robert Klemme: "Re: java.sql.sqlException closed statement"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]