• Post Reply Bookmark Topic Watch Topic
  • New Topic

why we need datasource  RSS feed

 
firoz silar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why we need datasource, we can directly use the connection pool instead of datasource
 
Vinay Raj
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using a connection provided via datasource helps the developer get a transaction enabled Connection. Typically application servers have wrappers around the datasource which help them monitor the transactional lifecycle of the connection. Essentially these objects participate in the Java Transaction Service transactions.

Also defining a datasource helps maintain the connectivity details like username, password, JDBC URL and the database vendor independent of the application. Thus these can be easily changed without affecting the user application code.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!