Here is what I have used
- String callQuery = "call " + pgmLibraryName + "/procName('" + inpParam + "')";
-
-
ResultSet rs = new BidderUtility().execStrSQL(callQuery);
And the code for execStrSQL is
- public ResultSet execStrSQL(String s) throws SQLException
-
{
-
-
ResultSet resultset = null;
-
java.sql.CallableStatement callablestatement = null;
-
-
try
-
{
-
if (dbCon==null||!connected||dbCon.isClosed())
-
{
-
connected = false;
-
this.connect();
-
}
-
-
callablestatement = dbCon.prepareCall(s, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
-
resultset = callablestatement.executeQuery();
-
}
-
catch(NullPointerException ex)
-
{
-
-
ex.printStackTrace();
-
}
-
catch (SQLException sqlEx)
-
{
-
if (sqlEx.getSQLState() != null && sqlEx.getSQLState().equals("08003"))
-
{
-
boolean retry=true;
-
{
-
if (iRetryCount++ <= MAX_RETRY)
-
{
-
if (this.doConnect()) retry=false;
-
}
-
else
-
{
-
retry=false;
-
}
-
}while(retry);
-
-
callablestatement = dbCon.prepareCall(s, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
-
resultset = callablestatement.executeQuery();
-
}
-
else
-
{
-
throw sqlEx;
-
}
-
}
-
-
return resultset != null ? resultset : null;
-
}
In the above code datasource for connection has been used. You may replace is with simpler connection. Again there are some other detailed codes that you may replace.
Hope this helps.