楼主你应该先通过jdbc驱动程序得到一个数据库的连接Connection。
Statement statement = connection.createStatement();
这段代码能够看出你的connection是没有被定义没有被初始化,不信你贴出你的代码看看。
Statement statement = connection.createStatement();
这段代码能够看出你的connection是没有被定义没有被初始化,不信你贴出你的代码看看。
Connection connection = null;
try{
...
}catch(..) {
...
}
你如果放在try,catch里面,connection就只在这个try,catch里面有效
Connection connection=DriverManager.getConnection(url,user,password);
tomcat的common\lib,就可以了,考完之后需要重新启动tomcat