It's not a secret anymore!
The moose likes JDBC and Relational Databases 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


JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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: 32481
    
214

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.


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why do we need datasource
 
jQuery in Action, 3rd edition