I am sharing my coding experience while calling a concurrent program from OA Framework:
OracleConnection pConncection = null;
OraclePreparedStatement ptmst = null;
OracleResultSet rs = null;
OracleCallableStatement cstmt = null;
/*
** Commented the below code as getting an error :: method getOADBTransaction() not found
** And tried with usual Oracle connection.
*/
//OADBTransaction tx = (OADBTransaction)getOADBTransaction();
//java.sql.Connection pConncection = tx.getJdbcConnection();
pConncection = (OracleConnection) TransactionScope.getConnection();
ConcurrentRequest cr = new ConcurrentRequest(pConncection);
String applnName = "APPLNAME"; //Application that contains the concurrent program
String cpName = "CPNAME"; //Concurrent program name
String cpDesc = "CPDESC"; // concurrent Program description
Vector cpArgs = new Vector();
cpArgs.addElement("TRANSACTIONNUM");
cpArgs.addElement("");
cpArgs.addElement(null);
// etc... as per your requirement
// Calling the method here
cr.submitRequest(applnName, cpName, cpDesc, null, false, cpArgs);
------
submitCPRequest(String arg1, String arg2, String arg3) throws Exception{
OracleConnection con = null;
OracleCallableStatement cstmt = null;
StringBuffer qry = new StringBuffer();
int requestid = 0 ;
try
{
con = (OracleConnection)TransactionScope.getConnection();
qry.append("BEGIN");
qry.append(" YOUR_PKG.yourMethod(?,?,?,?);");
qry.append(" END;");
cstmt = (OracleCallableStatement)con.prepareCall(qry.toString());
// cstmt.setString(....... Process at your own ..
}
catch(Exception e)
{
//take care
}
finally {
// take care
}
}
Other useful links .
here
here
and here
OracleConnection pConncection = null;
OraclePreparedStatement ptmst = null;
OracleResultSet rs = null;
OracleCallableStatement cstmt = null;
/*
** Commented the below code as getting an error :: method getOADBTransaction() not found
** And tried with usual Oracle connection.
*/
//OADBTransaction tx = (OADBTransaction)getOADBTransaction();
//java.sql.Connection pConncection = tx.getJdbcConnection();
pConncection = (OracleConnection) TransactionScope.getConnection();
ConcurrentRequest cr = new ConcurrentRequest(pConncection);
String applnName = "APPLNAME"; //Application that contains the concurrent program
String cpName = "CPNAME"; //Concurrent program name
String cpDesc = "CPDESC"; // concurrent Program description
Vector cpArgs = new Vector();
cpArgs.addElement("TRANSACTIONNUM");
cpArgs.addElement("");
cpArgs.addElement(null);
// etc... as per your requirement
// Calling the method here
cr.submitRequest(applnName, cpName, cpDesc, null, false, cpArgs);
------
submitCPRequest(String arg1, String arg2, String arg3) throws Exception{
OracleConnection con = null;
OracleCallableStatement cstmt = null;
StringBuffer qry = new StringBuffer();
int requestid = 0 ;
try
{
con = (OracleConnection)TransactionScope.getConnection();
qry.append("BEGIN");
qry.append(" YOUR_PKG.yourMethod(?,?,?,?);");
qry.append(" END;");
cstmt = (OracleCallableStatement)con.prepareCall(qry.toString());
// cstmt.setString(....... Process at your own ..
}
catch(Exception e)
{
//take care
}
finally {
// take care
}
}
Other useful links .
here
here
and here
Thanks a lot for sharing this code. I am getting method getOADBTransaction() not found exception.
ReplyDelete