Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

difference between Driver Manager and Data Source

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

how to use these two in the program.......
i read java tutorial but could not understand.....
 
author & internet detective
Posts: 40035
809
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 384
Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.




 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic