Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Datasource vs Connection

 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whats the diff between datasource object and a Connection object

The what does a connection pool is(collection of Connections)
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a datasource wraps a connection.
a connection pool pools connections.
a datasource may be a connection pool
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do u meant to say that a datasource is nothing but a wrapper for a
connection object or a connection pool object.

And what if the connectio pool itself consists of multiple connections

Thx in advance,
A Kumar
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The doc for DataSource is pretty clear: "A factory for connections to the physical data source that this DataSource object represents." So you get connections from the DataSource. It also points out that maintaining a connection pool or supporting distributed transactions are optional.

One nice thing is that datasources are configured outside the code so we can switch databases or even database vendors without touching any of the code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic