You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Suavi Ali Demir <de...@yahoo.com> on 2005/09/14 19:48:10 UTC

DriverManager question

A different question:
 
DriverManager.getConnection() is synchronized. If database A does not respond, we cannot get a connection to another database B neither. (Blocks the whole system). Is it advisable to use Driver.connect() and side step DriverManager?
 
Regards,
Suavi


Daniel John Debrunner <dj...@debrunners.com> wrote:Suavi Ali Demir wrote:

> After a shutdown=true, you should be able to connect to the same
> database again after doing a DriverManager.registerDriver(
> Class.forName(driverName).newInstance() )

No, that's not the correct way to start Derby or any other JDBC driver.
JDBC drivers are required to register themselves, applications should
not be registering drivers.
Simply loading the driver and creating an instance of it will start
Derby again.

Class.forName(driverName).newInstance();

Dan.




Re: DriverManager question

Posted by Shreyas Kaushik <Sh...@Sun.COM>.
Hi Suavi,

    Some changes have gone in as a part of Mustang ( Java SE 6) where 
this *synchronized* has been done away with. We targeted particularly 
the reason you are giving why it should not be synchronized.

thanks
Shreyas

Suavi Ali Demir wrote:

> A different question:
>  
> DriverManager.getConnection() is synchronized. If database A does not 
> respond, we cannot get a connection to another database B neither. 
> (Blocks the whole system). Is it advisable to use Driver.connect() and 
> side step DriverManager?
>  
> Regards,
> Suavi
>
>
> */Daniel John Debrunner <dj...@debrunners.com>/* wrote:
>
>     Suavi Ali Demir wrote:
>
>     > After a shutdown=true, you should be able to connect to the same
>     > database again after doing a DriverManager.registerDriver(
>     > Class.forName(driverName).newInstance() )
>
>     No, that's not the correct way to start Derby or any other JDBC
>     driver.
>     JDBC drivers are required to register themselves, applications should
>     not be registering drivers.
>     Simply loading the driver and creating an instance of it will start
>     Derby again.
>
>     Class.forName(driverName).newInstance();
>
>     Dan.
>
>