DataSource

DataSource is the factory for data source connections similar to DriverManager in JDBC, which helps in connection management. The following are some of the implementations that can be used in the application to obtain the Connection object:

  • DriverManagerDataSource: The DriverManager class provides a simple implementation of DataSource to be used in a test, or a standalone application that enables a new Connection object on every request via getConnection().
  • SingleConnectionDataSource: This class is an implementation of SmartDatSource that gives a single Connection object, which doesn't get closed after its use. It's useful only in single-threaded applications, and in making testing easy outside of the application server.
  • SmartDataSource: An approach for achieving efficiency has been provided by Spring. Developers need to write a class implementing the interface SmartDataSource , which must provide the database connection. It's best used in scenarios when the connection needs to be reusable.
  • AbstarctDataSource: As the name suggests, it's an abstract class, which acts as a base class for DataSource implementation. It facilitates developers to write their own implementation of DataSource.
  • DataSourceUtils: This is a helper class, which has static methods to obtain the database connection from DataSource.
  • DataSourceTransactionManager: This class is an implementation of PlatformTransactionManager for a connection per data source.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.190.102