wood burning stoves*
The moose likes JDBC 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
Bookmark "Data Source or Driver Manager - Performance Issues?" Watch "Data Source or Driver Manager - Performance Issues?" New topic
Author

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)


Regards
Azrael Noor
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1763
    
    7

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Data Source or Driver Manager - Performance Issues?