Support Article
Unable to send XML input to a stored Procedure
Summary
Unable to send XML parameters from the application to an Oracle stored procedure in a CALL method.
Error Messages
Not Applicable
Steps to Reproduce
Unknown
Root Cause
Not Applicable
Resolution
Use the below code from the Java step.
java.sql.Connection con = null;
java.sql.CallableStatement stmt = null;
oLog.error("First line");
try {
java.lang.Class.forName("oracle.jdbc.driver.OracleDriver");
con = java.sql.DriverManager.getConnection(
"<jdbc-rul>",
"<username>", "<password>");
stmt = con.prepareCall("{CALL PM_PEGA_TEST_INPUT(XMLType(?))}");
stmt.setObject(1, "<abc>1</abc>");
oLog.error("After setString call");
// stmt.setInt(1,45);
oLog.error("After setobject ");
stmt.execute();
//oLog.error("After execute"+stmt.getInt(2));
oLog.error("After execute");
oLog.error("Created DB Connection...." + con);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (java.sql.SQLException e) {
e.printStackTrace();
} finally {
try{
if (con != null)
con.close();
if (stmt != null)
stmt.close();
}catch(java.sql.SQLException e){
e.printStackTrace();
}
}
Published May 23, 2018 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.