Jus try out this code
//this call is the thread class where one will execute the store procedure
class DBProcess implements Runnable
{
private
String sp_name;
DBProcess(String sp_name)
{
this.sp_name = sp_name
}
public void run() throws Exception
{
Connection conn = null;
CallableStatement cstmt= null;
try
{
conn = connect("Pdr");
String query = "{ call "+ sp_name+"(?) }";
cstmt = conn.prepareCall(query);
cstmt.setString(1,"PDR_USER");
cstmt.execute();
}
finally
{
if(cstmt != null)
cstmt.close();
if(conn != null)
close(conn);
}
}
}
the following is the calling class
class RunDB
{
public static void main (String[] args)
{
if (args.length > 0)
{
DBProcess db = new DBProcess (args[0]);
try
{
new Thread(db).start();
}
catch (IllegalThreadStateException e)
{
//add code
}
catch (Exception e)
{
//add code
}
}
}
}