Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC

 
Satyajit Parida
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why try catch is required(compulsory) for JDBC connection?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It isn't required, you can always propagate exceptions.
But, databases are often remote processes and possibly on remote machines, and therefore you always need to be aware of the possibility of failure.
 
Satyajit Parida
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks David.I may have presnented this question not in a clear way.I was asking why we need to enclose our jdbc code in a try- catch block (handle it).I found the answer and it lies in checked exception handling.
[ July 09, 2008: Message edited by: Satyajit Parida ]
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic