1.

What is DataSource in JDBC? What are its benefits?

Answer»
  • DATASOURCE is an interface defined in javax.sql package and is used for obtaining the DATABASE connection. It can be used as a GOOD alternative for a DriverManager class as it allows the details about the database to your application program.
  • A driver that is accessed through a DataSource object, does not register itself with the DriverManager. Instead, a DataSource object is retrieved through a lookup operation and then it can be used to create a Connection object.
  • Benefits of DataSource:
    • Caching of PreparedStatement for FASTER processing
    • ResultSet maximum size threshold
    • Logging features
    • Connection timeout settings
    • Connection POOLING in servlet container using the support of JNDI registry.


Discussion

No Comment Found