This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC" Watch "JDBC" New topic


Satyajit Parida

Joined: Nov 24, 2006
Posts: 3
Why try catch is required(compulsory) for JDBC connection?
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

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

Joined: Nov 24, 2006
Posts: 3
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 ]
I agree. Here's the link:
subject: JDBC
It's not a secret anymore!