Establishing a Connection
by, 03-10-2012 at 07:44 AM (659 Views)
The very 1st step to use data source is to make connection with data source. Data source could be:
- Legacy file system
- Few other data sources, with a corresponding JDBC driver
For connecting an application to data source, these 2 classes are used.
- DriverManager: Complete implementation is provided by this class so that to make a connection b/w application and a data source, that is specified by URL of database. JDBC drivers are automatically loaded by this class.
- DataSource: This is a preferred approach to connect with the data source as it hides the data soruce. A DataSource objectís properties are set so that it represents a particular data source. This is one of the best approaches to make connection with data source as data source is made hidden by it.