We have to pass XMLTYPE as a input parameters in Oracle stored procedure from java.
We convert XML file into XMLTYPE by using XMLType(connection, inXml). After execution of line#5, the control goes to line#12 and line#6 to line#8 are skipped. There is no exception raised. We don't know exactly what XMLType(connection, inXml) doing internally.
After line#5, it skip remaining line and control goes to line#12 and even no exception raised.
We manually check null at line#12 and throw exception.
Can anyone help us to identify what is the problem with this code?
We using below java and db version,
Java : 7
DB : Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
Jar for XMLTYPE : xdb6.jar and xmlparserv2-12.1.0.2.jar
JDBC connection type : thin
Below is the sample code,
1 XMLType xmlFileInXmlType = null;
2 File xmlFile = new File("D:\\filePath\\ALP.xml");
3 FileInputStream inXml = new FileInputStream(xmlFile);
4 try {
5 xmlFileInXmlType = new XMLType(connection, inXml);
6 CallableStatement cs = connection.prepareCall(call XXXX.XXXX(?));
7 cs.setObject(1, xmlFileInXmlType);
8 cs.execute();
9 }catch(Exception e) {
10 throw e;
11 }finally {
12 if(xmlFileInXmlType == null) {
13 throw new Exception("XML File cannot able to convert into XML Object");
14 }
15 }