Difference between drivermanager and datasource
Answers
Answered by
0
I will go straight to the point. If you are building an enterprise Java app then go for data source. That way -
Client app need not know about the DB details, username , password. App server will take care of it. With datasource all you need is a jndi name properties of which can be configured at app level.App server takes care of creating and closing connections. You don’t have to manage it in your client application.Data source has support for creating pool of connection whereas data manager does not.To sum it up if you are new to JDBC and trying out a sample app in Java to connect to DB go with DriverManager. If you are well experience trying to build jdbc support in an enterprise app use datasource -
Client app need not know about the DB details, username , password. App server will take care of it. With datasource all you need is a jndi name properties of which can be configured at app level.App server takes care of creating and closing connections. You don’t have to manage it in your client application.Data source has support for creating pool of connection whereas data manager does not.To sum it up if you are new to JDBC and trying out a sample app in Java to connect to DB go with DriverManager. If you are well experience trying to build jdbc support in an enterprise app use datasource -
Similar questions