• Post Reply Bookmark Topic Watch Topic
  • New Topic

why do we need datasource  RSS feed

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
why do we need datasources, we can directly get the connection from
from connection pool.

regards,
Firoz.
 
author & internet detective
Marshal
Posts: 37698
575
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!