【SQLException】 QueryRunner

报错:

Caused by: java.lang.RuntimeException: java.sql.SQLException: QueryRunner requires a DataSource to be invoked in this way, or a Connection should be passed in
	at dao.CustomerDao.findAll(CustomerDao.java:129)
	at service.CustomerService.findAll(CustomerService.java:27)
	at servlet.CustomerServlet.findAll(CustomerServlet.java:61)
	... 18 more

根据https://blog.csdn.net/u010782846/article/details/51327186
可知

 Number number=(Number) qr.query(sql,new ScalarHandler<>());

改成

Number number=(Number) qr.query(con, sql,new ScalarHandler<>());

ok

你可能感兴趣的:(PLSQL,JavaWeb)