关于数据库连接(c3p0连接mysql)出现的问题

本来是想通过jsp页面添加一个数据,跳转到访问serlvlet页面通过jbutils连接mqsql保存数据,但是我检查了c3p0的配置文件和datasource对象,queryrunner对象都可以正常新建,具体问题找不到,谢谢大家了这是访问页面的报错代码
HTTP Status 500 - java.lang.RuntimeException: java.sql.SQLException: QueryRunner requires a DataSource to be invoked in this way, or a Connection should be passed in

type Exception report

message java.lang.RuntimeException: java.sql.SQLException: QueryRunner requires a DataSource to be invoked in this way, or a Connection should be passed in

description The server encountered an internal error that prevented it from fulfilling this request.

exception

java.lang.RuntimeException: java.lang.RuntimeException: java.sql.SQLException: QueryRunner requires a DataSource to be invoked in this way, or a Connection should be passed in
serviceimp.FoodTypeService.save(FoodTypeService.java:62)
servlet.FoodTypeServlet.addFoodType(FoodTypeServlet.java:65)
servlet.FoodTypeServlet.doGet(FoodTypeServlet.java:44)
servlet.FoodTypeServlet.doPost(FoodTypeServlet.java:105)
javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
root cause

java.lang.RuntimeException: java.sql.SQLException: QueryRunner requires a DataSource to be invoked in this way, or a Connection should be passed in
daoimp.FoodTypeDao.save(FoodTypeDao.java:36)
serviceimp.FoodTypeService.save(FoodTypeService.java:59)
servlet.FoodTypeServlet.addFoodType(FoodTypeServlet.java:65)
servlet.FoodTypeServlet.doGet(FoodTypeServlet.java:44)
servlet.FoodTypeServlet.doPost(FoodTypeServlet.java:105)
javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
root cause

java.sql.SQLException: QueryRunner requires a DataSource to be invoked in this way, or a Connection should be passed in
org.apache.commons.dbutils.AbstractQueryRunner.prepareConnection(AbstractQueryRunner.java:200)
org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:437)
daoimp.FoodTypeDao.save(FoodTypeDao.java:34)
serviceimp.FoodTypeService.save(FoodTypeService.java:59)
servlet.FoodTypeServlet.addFoodType(FoodTypeServlet.java:65)
servlet.FoodTypeServlet.doGet(FoodTypeServlet.java:44)
servlet.FoodTypeServlet.doPost(FoodTypeServlet.java:105)
javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.39 logs.

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐