Why do we use a DataSource instead of a DriverManager?

前端 未结 5 497
栀梦
栀梦 2020-12-07 07:39

I am reading the Java JDBC specification (vr. 4) and I encountred this statement:

DataSource — this interface was introduced in the JDBC 2.0 Optional

5条回答
  •  广开言路
    2020-12-07 08:24

    DataSource objects can provide connection pooling and distributed transactions, so you may have to use DataSource if you need one of or both these features.

提交回复
热议问题