从我阅读的示例和MysqlConnectionPoolDataSource的文档
http://www.control.auc.dk/~04gr733/filer/javadoc-DB-driver/com/mysql/jdbc/jdbc2/optional/MysqlConnectionPoolDataSource.html
javase应用程序似乎不能使用连接池。这是真的吗?我可以让连接池为MySql工作吗?
更新:
/*
* Create a JNDI Initial context to be able to
* lookup the DataSource
*
* In production-level code, this should be cached as
* an instance or static variable, as it can
* be quite expensive to create a JNDI context.
*
* Note: This code only works when you are using servlets
* or EJBs in a J2EE application server. If you are
* using connection pooling in standalone Java code, you
* will have to create/configure datasources using whatever
* mechanisms your particular connection pooling library
* provides.
*/
这就是为什么我要寻找一种方法来为javase应用程序实现这一点。但是,在我看来,他们是在引用您获取数据源引用的方式。我不能使用依赖注入框架或手动插入对DAO对象的数据源的依赖吗?我要试一试。