File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Data Sources" Watch "Data Sources" New topic

Data Sources

Bhupendra Malviya

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.

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

Joined: Oct 01, 2003
Posts: 15
Thanks Eugene,
It was useful information and it helped me understand the topic.
Thanks again
subject: Data Sources
It's not a secret anymore!