hello all
my prob is tht i want to abort sql query running in a
thread through different thread
my program looks like this
public class
test {
public static void main(
String args[]) throws Exception
{
String driverName = "oracle.jdbc.driver.OracleDriver";
String url = "jdbc
racle:thin:@192.168.103.46:1521:test";
Class.forName(driverName); // load the driver
Connection connection = DriverManager.getConnection(url, "scott", "tiger");
ConnThread connThread = new ConnThread();
connThread.stmt = connection.prepareCall("{call NEWOBJECT(?)}");
connThread.stmt.registerOutParameter(1,OracleTypes.CURSOR);
connThread.stmt.setQueryTimeout(1);
connThread.start();
System.out.println ("waiting");
Thread.sleep(20);
System.out.println ("waiting done");
System.out.println ("closing conn");
connThread.stmt.cancel();
System.out.println ("closing conn done");
}
}
class ConnThread extends Thread
{
CallableStatement stmt = null;
public void run()
{
try
{
System.out.println ("Executing query");
stmt.executeQuery();
System.out.println ("Executing query done");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
i have achieved tht for normal sql queries. but i want to the samr for sql procedures. can someone tell me is it even possible???
also i want to know whether can be done for ORACLE, MS SQL and MS ACCESS
Thanking in advance
regards