org.apache.catalina.loader.WebappClassLoader findResourceInternal 信息: Illegal access: this web application instance has been stopped already. Could not load . The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. 出现这样的信息
插入数据的代码 connection = new JDBConnection(); for(int i = 0;i < 10;i++) { int answerid = i + 1; sql = "insert into answer values (" + answerid + ",701," + str1[i] + "," + str3[i]+ ",'杭州')"; connection.executeUpdate(sql); } connection.closeConnection();
OracleDataSource ds = new OracleDataSource(); ds.chinese wholesalers(url); ds.setUser(userName); ds.setPassword(password); con=ds.getConnection();
this web application instance has been stopped already. Could not load . 这里说得很明白了啊!
以前我也有遇到过的
try {
Class.forName(dbDriver).newInstance(); //加载数据库驱动
System.out.println("数据库加载成功");
}
catch (Exception ex) {
System.out.println("数据库加载失败");
}
} //创建数据库连接
public boolean creatConnection() {
try {
OracleDataSource ds = new OracleDataSource();
ds.setURL(url);
ds.setUser(userName);
ds.setPassword(password);
con=ds.getConnection();
System.out.println("连接数据库成功");
}
catch (SQLException e) {
}
return true;
}
//对数据库的增加、修改和删除的操作
public boolean executeUpdate(String sql) {
if (con == null) {
creatConnection();
}
try {
Statement stmt = con.createStatement();
System.out.println("即将执行操作");
int iCount = stmt.executeUpdate(sql);
System.out.println("操作成功,所影响的记录数为" + String.valueOf(iCount));
}
catch (SQLException e) { }
return true;
}
//关闭数据库的操作
public void closeConnection() {
if (con != null) {
try {
con.close();
System.out.println("关闭数据库成功");
}
catch (SQLException e) {
e.printStackTrace();
}
finally {
con = null;
}
}
}代码就是这样子的,有问题么 ?
信息: Illegal access: this web application instance has been stopped already. Could not load . The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
出现这样的信息
connection = new JDBConnection();
for(int i = 0;i < 10;i++)
{
int answerid = i + 1;
sql = "insert into answer values (" + answerid + ",701," + str1[i] + "," + str3[i]+ ",'杭州')";
connection.executeUpdate(sql);
}
connection.closeConnection();
ds.chinese wholesalers(url);
ds.setUser(userName);
ds.setPassword(password);
con=ds.getConnection();
这里说得很明白了啊!
conn = db.getConnection();
ps = conn.prepareStatement(sql);
for(int i = 0;i < 10;i++)
{
int answerid = i + 1;
ps.setString(1, " + answerid + ",701," + str1[i] + "," + str3[i]+ ");
ps.addBatch();
}
ps.executeBatch();