Chapter 23: Build an XML Database OCI C++ Application
Overview
Many C++ applications require direct access to database data, typically because they are designed to work with large data sets or to retrieve and update data frequently. While Oracle offers PL/SQL as an in the database programming language, many applications need the flexibility and functionality of C++ or need to offload program logic from the database. This is where building your C++ application using the Oracle C++ Call Interface (OCCI) libraries can be a real value. However, unlike the Oracle Call Interface (OCI) for C, OCCI has not had XMLType support added. Generally, this means that C++ programs must use C code and thus OCI. However, as you will discover in this chapter, you can use the Oracle XDK C++ components with some C++ wrappers of OCI code to enable C++ XMLType support. C++ applications that would have had to serialize the output from a query and reparse using DOM or SAX APIs on the client in order to process XML no longer need to do so because they can take advantage of a DOM within the database as an XMLType. Thus, when the data sets become large, especially when using the DOM APIs, you’ll be able to preserve memory resources because you no longer need to materialize the entire data set on the client in order to access and modify or update it. Oracle Database 10g with the inclusion of Oracle XDK 10g now offers XMLType support to C++ applications through a set of new APIs located in the xml*.hpp header files. The reason these APIs are not included in the OCCI header files is that they are the same APIs that can be used for stand-alone XDK applications.