Browse DevX
Sign up for e-mail newsletters from DevX


.NET and Oracle Java Stored Procedures—Bridging the Gap with XML : Page 3

Oracle's XML toolkit (the XDK), provides the foundation and base classes that you can use to bridge the data gap between Java Stored Procedures and .NET.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

.NET Web Service
The .NET Web service is very simple and similar to the Web Form example. The getXMLData WebMethod of the Web service named EmpService returns an XmlDocument object. The Web service calls the PL/SQL procedure getXML, which returns a CLOB object containing an XML representation of the JDBC ResultSet. The CLOB object is then cast to a string variable, lob_data, through the ODP.NET OracleClob object. The XmlDocument object doc is then loaded from lob_data and returned to the calling program:

// Bind the Oracle CLOP object Output parameter OracleParameter param = cmd.Parameters.Add("clobdata",OracleDbType.Clob); param.Direction = ParameterDirection.Output; // Execute command cmd.ExecuteNonQuery(); // Cast the Oracle CLOB into a .NET // string throught the Oracle CLOB object string clob_data = (string) ((OracleClob)(cmd.Parameters[1].Value)).Value; // Load the XML string into the document variable doc.LoadXml(clob_data); . . return doc;

See Listing 5 for the complete listing of EmpService.

There was, in fact, a solution to the problem and it did include using XML. The solution presented above is not a very difficult or complex programming scenario, and when you look at all of the components that make the data exchange work, there is nothing that is really out of the ordinary. The complexity of the solution lies not only in the need to know and understand three different development tool sets, .NET, PL/SQL, and Java, but also understanding how they work or don't work together.

Jeff Hilts is a technical consultant with more than 15 years experience designing and developing software. He currently specializes in Microsoft .NET tools, Java, and Oracle databases. Reach him at jeffhilts@hotmail.com.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date