• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC DB2 Mainframe SQLException - How to do conditional logic depending on SQLCODE

 
Joe Brigs
Ranch Hand
Posts: 70
IBM DB2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Executing a simple select on a DB2 Mainframe DB table. Displaying the following on the SQLException ( which I know is a not found - sqlcode = +100 ) ==> | e.getMessage = [jcc][t4][10120][10898][3.62.56] Invalid operation: result set is closed. ERRORCODE=-4470, SQLSTATE=null | In Cobol , if we cared we would simply do IF +100 Do something. I'm sure it’s obvious but I just can’t find a simple answer on the internet. My background is mainframe so please forgive my stupidity. What do I have to ask SQLEXCFPTION to bring back the SQLCODE , so I can integrate it ?
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Brigs wrote:What do I have to ask SQLEXCFPTION to bring back the SQLCODE , so I can integrate it ?

Are you looking for SQLException.getErrorCode()?

From the javadoc of this method
Retrieves the vendor-specific exception code for this SQLException object.


Hope it helps!
Kind regards,
Roel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic