Java Tutorial表示有两种方法可以通过JDBC连接到数据库:使用DriverManager类(旧的,不推荐使用)和使用DataSource类.
我不知道如何使用DriverManager做到这一点:
Connection con = DriverManager.getConnection("jdbc:sqlite:mytest.db");
...
但我找不到如何通过JDBC使用DataSource for SQLite. SQLite(或JDBC驱动程序提供程序,我不知道如何正确调用它)支持使用DataSource吗?
我最好的猜测是我将使用org.sqlite.SQLiteDataSource类(它来自sqlite-jdbc-3.15.1.jar用于Xerial sqlite-jdbc驱动程序),但是怎么样?是这样吗?我也猜测,如何做到这一点应该是在Xerial驱动程序文档中,但它们只给出了如何使用DriverManager进行连接的示例.
所以我要求大师的帮助确认this Xerial驱动程序/ jar不支持DataSource语法,或者举例说明如何操作,或者建议使用DataSource支持替代驱动程序(对于SQLite来自Java),或者建议否则…
JDBC Driver Manager — The JDBC DriverManager class defines objects
which can connect Java applications to a JDBC driver. DriverManager
has traditionally been the backbone of the JDBC architecture. It is
quite small and simple.
The Standard Extension packages javax.naming and ja