aspose file tools*
The moose likes JDBC and the fly likes why do we need datasource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "why do we need datasource" Watch "why do we need datasource" New topic
Author

why do we need datasource

firoz silar
Greenhorn

Joined: Dec 24, 2005
Posts: 11
hi,
why do we need datasources, we can directly get the connection from
from connection pool.

regards,
Firoz.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30758
    
156

Firoz,
It protects your code from change. If you use a DataSource, your code doesn't need to be aware of the database, password, type of driver, etc. It also allows the driver to be connection pooling and or XA (two phase commit) without changing the code.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
Consider Paul's rocket mass heater.
 
subject: why do we need datasource