Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) 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 ]
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!