How to drop this exception?
- From: Ikke <ikke@xxxxxxx>
- Date: Sun, 24 Sep 2006 19:20:08 GMT
Hi everybody,
Here is some code I've been working on...
--- code ---
String connect = "jdbc:mysql://code/db?user=me&password=none";
Driver driver = new com.mysql.jdbc.Driver();
dbc = new DatabaseConnection();
dbc.openConnection(driver, connect);
--- /code ---
Those last two lines are needed to use a custom class from some package I
received. The openConnection method expects, as you can see, a driver and a
connectionstring.
No problems for that last part - but in order to create a new Driver
object, I need to catch the SQLException which can be thrown by the Driver
constructor.
The reason to use the package in the first place was because it hides all
that and simply returns a boolean (connected / not).
Is it possible to:
a) construct a new Driver object without having to catch the SQLException
(probably not, and not a very good idea imho)
b) pass in a Driver object, and let the method handle the exceptions
c) pass in the name of a class which needs to be instantiated (best option
I guess)
Thanks in advance,
Ikke
.
- Follow-Ups:
- Re: How to drop this exception?
- From: Oliver Wong
- Re: How to drop this exception?
- Prev by Date: Re: listing MAC addresses of attached network cards
- Next by Date: Error help?
- Previous by thread: listing MAC addresses of attached network cards
- Next by thread: Re: How to drop this exception?
- Index(es):
Relevant Pages
|