Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes Data Sources Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Data Sources" Watch "Data Sources" New topic
Author

Data Sources

Bhupendra Malviya
Greenhorn

Joined: Oct 01, 2003
Posts: 15
Hi All,
Can anyone please tell me , what are the advantages of using a datasource over
DriverManager to get a connection,not just with reference to pure java but also from a j2ee application point of view.

Thanks
Bhupendra
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
This is a JDBC question, and should be posted in the corresponding forum.
Data source is an optional package in JDBC2.0, and offers many improvements over DriverManager.getConnection(). Most notably, connection pooling is part of it. Perhaps the best reason not to use DriverManager.getConnection() is because it has known problems, as documented in Sun's Bug Database. Under certain circumstances, the call to DriverManager.getConnection() results in a locked thread, and if you run in the multi-app server, all the other apps that use DriverManager will be doomed.
[ October 27, 2003: Message edited by: Eugene Kononov ]
Bhupendra Malviya
Greenhorn

Joined: Oct 01, 2003
Posts: 15
Thanks Eugene,
It was useful information and it helped me understand the topic.
Thanks again
Bhupendra
 
jQuery in Action, 2nd edition
 
subject: Data Sources