Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is the difference between the DriverManager and a DataSource?

0
Posted

What is the difference between the DriverManager and a DataSource?

0

The first version of JDBC specified using the class java.sql.DriverManager to create Connections. This turned out to be insufficiently flexible and later versions of the JDBC spec define an additional way to create Connections using DataSources. We recommend that you use DataSources.To get a Connection using the DriverManager, first, you register the OracleDriver:DriverManager.registerDriver(new OracleDriver());You only have to register the driver once. Then call getConnection to create a new connection. There are three getConnection methods:getConnection(String url) getConnection(String url, Properties info) getConnection(string url, String user, String password)each of which returns a connection.DataSources provide a more flexible way to create Connections. Once you have a DataSource, getting a connection from a DataSource is just as easy as using the DriverManager. DataSources were designed to be used with JNDI, but you don’t have to use JNDI to use DataSources. DataSources can do t

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123