或者有时报错是
A web application appears to have started a thread named ["thread name"] but has failed to stop it. This is very likely to create a memory leak.
说个非配置和tomcat bug的原因,就是自己代码问题的情况
原因:存储过程中的变量定义顺序和在java代码中调用时的变量赋值顺序有问题。
例子:
Create PROCEDURE your_proc_name
(
@Tables varchar(1000),
@PrimaryKey varchar(100),
@CurrentPage int,
@PageSize int,
/*以上四个变量是需要赋值的,注意顺序和类型,不要将赋了值的变量插在他们中间*/
@Sort varchar(200) = NULL,
@Fields varchar(1000) = '*',
@Filter varchar(1000) = NULL,
@Group varchar(1000) = NULL
)
as
........
Java
CallableStatement cs=null;
cs=con.prepareCall("{call CN5135_SP_Pagination(?,?,?,?)}");
cs.setString("Tables", "authors");/*参数不要写成"@Tables",下面的也是*/
cs.setString("PrimaryKey", "au_id");
cs.setInt("CurrentPage", targetpage);
cs.setInt("PageSize", pagesize);
........
总结:最好不要把多个sql语句写到同一个存储过程中,要写的话,除非是参数相同,或者不带参数