• Post Reply Bookmark Topic Watch Topic
  • New Topic

why do we need datasource

 
firoz silar
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.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36031
432
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.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!