java.sql.SQLException: QueryRunner requires a DataSource to be invoked in this way, or a Connection
来源:互联网 发布:c语言结构体typedef 编辑:程序博客网 时间:2024/06/03 09:27
这个错误是使用c3p0-0.9.2-pre1.jar配置数据库的时候,按照字面意思就是说:SQLException异常:QueryRunner需要一个数据源以这种方式调用,或者应该传入的连接池。我们看前半段,需要一个数据源说明问题在于是否有数据源,后半句是说明是否有连接池。所以我们需要打断点看 :
1.不能缺连接池并且连接池不能为NULL 这就让我们去查看我们是否配置正确然后正常的获得。
2.是否把连接池传入。
比如我的错误:
newUser = query.query(sql, new BeanHandler<User>(User.class),
params);
正确的是:
newUser = query.query(conn,sql, new BeanHandler<User>(User.class),
params);
我虽然获得了连接池,但是并没有传入。
2 0
- java.sql.SQLException: QueryRunner requires a DataSource to be invoked in this way, or a Connection
- java.sql.SQLException: QueryRunner requires a DataSource to be invoked in this way, or a Connection
- 【c3p0】 java.sql.SQLException: An attempt by a client to checkout a Connection...
- java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
- java.sql.SQLException: An attempt by a client to checkout a Connection has timed out
- java.sql.SQLException: ORA-01799: a column may not be outer-joined to a subquery
- Hive 笔记异常java.sql.SQLException: Unable to open a test connection to the given database.
- dbcp连接池错误Failed to validate a poolable connection. java.sql.SQLException:
- java.sql.SQLException: ResultSet may only be accessed in a forward direction.报错
- oracle报错:java.sql.SQLException: An attempt by a client to checkout a Connection has timed out
- Caused by: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out
- Vagrant is attempting to interface with the UI in a way that requires a TTY
- Hive 笔记异常(java.sql.SQLException: Unable to open a test connection to the given database. JDBC url =)
- java.sql.SQLException: ORA-28009: connection as SYS should be as SYSDBA or SYSOPER
- 解决 Android Nougat requires the IDE to be running with Java 1.8 or later Install a supported JDK
- jqgjava.sql.SQLException: An attempt by a client to checkout a Connection ha
- a simple way ,to programing or writting!
- java.sql.SQLException: Connection has already been created in this tx context for pool named ...
- css给父盒子加display:inline实现子盒子自动撑开 实现子盒子和父盒子都浮动
- Spring Security 4 使用@PreAuthorize,@PostAuthorize, @Secured, EL实现方法安全(带源码)
- android自定义View之钟表
- javascript之object对象
- HDU 1331 Function Run Fun
- java.sql.SQLException: QueryRunner requires a DataSource to be invoked in this way, or a Connection
- Java实现B树
- 领导符合这9条标准,就值得追随!(必看)
- Android 中文API:Running Gradle Builds
- 下载图片webcollector
- 内联函数真的可以提高程序执行效率吗
- 贪心阶乘之和
- PHP中yii2日期时间控件的使用
- POJ 2109 Power of Cryptography