use Utils.dropProcedureIfExists()
@@ -65,7 +65,7 @@ public class ExceptionTest extends AbstractTest {
try {
conn = (SQLServerConnection) DriverManager.getConnection(connectionString);
- dropWaitForDelayProcedure(conn);
+ Utils.dropProcedureIfExists(waitForDelaySPName, conn.createStatement());
createWaitForDelayPreocedure(conn);
conn = (SQLServerConnection) DriverManager.getConnection(connectionString + ";socketTimeout=" + (waitForDelaySeconds * 1000 / 2) + ";");
@@ -90,12 +90,6 @@ public class ExceptionTest extends AbstractTest {
}
}
- private void dropWaitForDelayProcedure(SQLServerConnection conn) throws SQLException {
- String sql = " IF EXISTS (select * from sysobjects where id = object_id(N'" + waitForDelaySPName
- + "') and OBJECTPROPERTY(id, N'IsProcedure') = 1)" + " DROP PROCEDURE " + waitForDelaySPName;
- conn.createStatement().execute(sql);
- }
-
private void createWaitForDelayPreocedure(SQLServerConnection conn) throws SQLException {
String sql = "CREATE PROCEDURE " + waitForDelaySPName + " AS" + " BEGIN" + " WAITFOR DELAY '00:00:" + waitForDelaySeconds + "';" + " END";
conn.createStatement().execute(sql);
