• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You would need to post some code, but it is still possible for the close operations to throw exceptions.
 
BalaiahRaju ChamarthiRaju
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic