| Author |
difference between Driver Manager and Data Source
|
Inder Kumar Rathore
Ranch Hand
Joined: Apr 14, 2010
Posts: 41
|
|
how to use these two in the program.......
i read java tutorial but could not understand.....
|
Thanks
Living is easy with your eyes closed.....
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26496
|
|
|
A DataSource is an externally managed connection - usually used with a connection pool. A Driver Manager creats the connection directly in code for one time use.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Lalit Mehra
Ranch Hand
Joined: Jun 08, 2010
Posts: 369
|
|
a data source is one where you get your entries from usually a database
a DataManager is an interface in java JDBC that provides you with the comfort of creating connections to that data source
regards,
Lucky
|
http://plainoldjavaobject.blogspot.in
|
 |
Prashant Hurria
Ranch Hand
Joined: Mar 23, 2009
Posts: 40
|
|
You create a JDBC Connection using Driver manager by using something like the following code
now this operation is expesive so you might want to implement a factory which creates a conection pool.
Also you might not want to right the boiler plate code again and again so dtasource to the rescue ....
Use a Project like apache DBCP http://commons.apache.org/dbcp/
create an instance of org.apache.commons.dbcp.BasicDataSource class supply it with the Driver Name,Username ,Password ,URL
Simply get the connection by calling a getter no boiler plate code needed.
|
 |
 |
|
|
subject: difference between Driver Manager and Data Source
|
|
|