This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Data Source or Driver Manager - Performance Issues? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Data Source or Driver Manager - Performance Issues?" Watch "Data Source or Driver Manager - Performance Issues?" New topic

Data Source or Driver Manager - Performance Issues?

Azrael Noor
Ranch Hand

Joined: Jul 29, 2010
Posts: 382
In Driver Manager class, i open connection do process close it.....

> open connection
> check if previous connection is there
> pick it
> process db operation
> if required then close it
> else keep it using and close after some hundreds of queries.

In Datasource Connection, i have read that Connection is created by App Server.

What is performance differences between two.

As i am runninng 430 queries using Driver Manager(takes 10 to 20 Seconds) and if shift to DataSource then does it effect time if yes how much?

(I am not using Hibernate or ORM tool, simple SQL packages of Java and javax)

Azrael Noor
Jelle Klap

Joined: Mar 10, 2008
Posts: 1924

As far as obtaining a Connection, it depends on the implementation of the DataSource interface. An implementation might create a new Connection instance for every invocation of getconnection(), or it may be backed by a pool of Connection objects. The former would be on-par with how a Connection is created by the DriverManager class. The latter would be more efficient as Connections are reused instead of recreated over and over. This approach is very commonly used by applications deployed in servlet containers / application servers.

Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Have you checked out Aspose?
subject: Data Source or Driver Manager - Performance Issues?
jQuery in Action, 3rd edition