|
-
Nov 18th, 2006, 07:34 PM
#1
Thread Starter
Frenzied Member
why do JDBC lines of code require a try/catch block be provided. ?
Hello
why do JDBC lines of code require a try/catch block be provided. ?
-
Nov 18th, 2006, 08:53 PM
#2
Frenzied Member
Re: why do JDBC lines of code require a try/catch block be provided. ?
 Originally Posted by vb_student
Hello
why do JDBC lines of code require a try/catch block be provided. ?
a number of exceptions could be thrown. You may provide a bad password, bad db name, or the connection may fail due to some obscure reason. *Just because you want to establish a connection with a database doesn't mean it's going to happen.
-
Nov 18th, 2006, 09:17 PM
#3
Lively Member
Re: why do JDBC lines of code require a try/catch block be provided. ?
It's been a while since I've done Java, but if I remember correctly, exceptions can be defined as checked or non-checked. A checked exception must either handle the exception, or throw it.
So whoever wrote the JDBC methods thought it was a good idea to have those methods use checked exceptions.
There's a lot of discussion on whether checked exceptions are a good idea or not. I'm not offering an opinion, but that's the way it is in Java.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|