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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30352
    
150

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why do we need datasource