3
我嘗試殺死一個MS SQL服務器(8)的進程與一個準備在Java語句。但我總是收到異常:com.microsoft.sqlserver.jdbc.SQLServerException:第1行:'@ P0'附近的語法錯誤。從java準備語句中殺死MS SQL進程?
任何想法?
public void killBlockingProcess(int spid) {
PreparedStatement ps = null;
try {
ps = connection.prepareStatement("kill ?");
ps.setInt(1, spid);
boolean res=ps.execute();
}
catch (Exception ex) {
logger.error(this + ",killBlockingProcess: " + ex.getMessage());
}
finally
{
try {ps.close(); } catch (Exception exp){}
}
}
謝謝Andomar! – 2011-05-03 12:02:40