Forums Register Login

Any Possibilities to get other than SQLException while using executeUpdate() method

+Pie Number of slices to send: Send
Hi,

I am Using PreparedStatement to insert Record into database.
after calling executeUpdate() method. I am writing finally block to close all the stmt,rs..

Record is inserting into Database.. but I am getting Exception.. how it is possible..

is there any possible to get otherthan SQLException.
please let me know..

Thanks in Advance..
+Pie Number of slices to send: Send
You would need to post some code, but it is still possible for the close operations to throw exceptions.
+Pie Number of slices to send: Send
My code is like this
--------------------
String sql="INSERT INTO EXPORT_LOG EXPL_LUW_ID, EXPL_SEQ, EXPL_STAMP, EXPL_TBLA_ID, EXPL_ROW_KEY, EXPL_EMP_ID,EXPL_ACTION, EXPL_C_FIELD_IDS, EXPL_C_VALUES, EXPL_STATUS, EXPL_P_TBLA_ID, EXPL_P_KEY, EXPL_SOURCE )VALUES (?, ?, TO_DAT(?,'YYYYMMDDHH24MISS'), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);

PreparedStatement stmt = null;
Reader reader= null;
try {
stmt = app.getDataConnection().prepareStatement(sql);
stmt.setString(1,expl.getLuwId());
stmt.setInt(2,expl.getSeq());
stmt.setString(3,expl.getStamp());
stmt.setInt(4,expl.getTableId());
stmt.setString(5,expl.getRowKey());
stmt.setInt(6,expl.getEmpId());
stmt.setString(7,expl.getAction().toString());
stmt.setString(8,expl.getChildFieldIds());
if(expl.getChildValues()!=null){
reader=new CharArrayReader(expl.getChildValues().toCharArray());
stmt.setCharacterStream(9, reader, expl.getChildValues().toCharArray().length);
}
else{
stmt.setString(9,expl.getChildValues());
}
stmt.setString(10,expl.getStatus().toString());
stmt.setInt(11,expl.getParentTableId());
stmt.setString(12,expl.getParentKey());
stmt.setString(13,expl.getSource().toString());
stmt.executeUpdate();
} catch(SQLException e){
handleSqlException(e,sql, app);
}
finally {
DbUtils.closeQuietly(stmt);
IOUtils.closeQuietly(reader);
}
}

------------
in the above code, the record is inserting into database, after that it is throwing SQLException, I think this is throwing in finally block.. can you tell me is this possible.
and is there any chaces to get other than SQLException.

-Bala
+Pie Number of slices to send: Send
Bala,
The finally block delegates to the method DbUtils.closeQuietly(stmt). What does that do? One thing that is suspicious is that I can't see where/how the connection is closed. Maybe you have a connection leak?

Posting the actual SQL Exception text might give more clues.
I didn't say it. I'm just telling you what this tiny ad said.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1770 times.
Similar Threads
Constraint on table that prohibits record inserts using web based app(JAVA)
To delete a record
What is the difference between executeUpdate and execute?
Problem accessing MetaData with DB2
Help a beginner create a database! ;-)
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 14:26:29.