This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Datasource vs Connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Datasource vs Connection" Watch "Datasource vs Connection" New topic
Author

Datasource vs Connection

A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Whats the diff between datasource object and a Connection object

The what does a connection pool is(collection of Connections)
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
a datasource wraps a connection.
a connection pool pools connections.
a datasource may be a connection pool


42
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
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

Joined: Jan 29, 2003
Posts: 8791
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.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Datasource vs Connection
 
Similar Threads
Opening the Closed Connection
DB2
data source reference?
Connection Pooling samples
what is the different between Basic DataSource and pooled DataSource