This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Kubernetes in Action and have Marko Luksa on-line!
See this thread for details.
Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JDBC  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why try catch is required(compulsory) for JDBC connection?
 
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!