关于恢复数据库SQL2000出现的问题!!高手帮忙解决下 谢谢
我用的是JSP+JAVABEAN实现恢复这个功能,但有时候能够恢复 有时候却提示错误:][SQL Server]未能找到存储过程 'kill51 '
高手帮忙解决下 谢谢
JAVABEAN里代码为:
public void cut(String datebasename)throws Exception
{
Connection con=DriverManager.getConnection( "jdbc:odbc:sun1 ", "sa ", " ");
Statement stmt=con.createStatement();
ResultSet rs=null;
rs=stmt.executeQuery( "select spid from sysprocesses where dbid=db_id( ' "+datebasename+ " ') ");
while(rs.next())
{
stmt.execute( "kill " + rs.getInt( "spid "));
}
}
public void rdata(String datebasename,String bakfile)throws Exception
{
Connection con=DriverManager.getConnection( "jdbc:odbc:sun1 ", "sa ", " ");
Statement stmt=con.createStatement();
stmt.executeUpdate( "restore database "+datebasename+ " from disk= ' "+bakfile+ " ' ");
}
------解决方案--------------------Statement stmt=con.createStatement();
Statement stmt2=con.createStatement();
ResultSet rs=null;
rs=stmt.executeQuery( "select spid from sysprocesses where dbid=db_id( ' "+datebasename+ " ') ");
while(rs.next())
{
stmt2.execute( "kill " + rs.getInt( "spid "));
}