The XML Contentbase Connector (XCC) is an interface to communicate with MarkLogic Server from a Java middleware application layer. This chapter provides background on XCC and includes the following sections:
The XML Contentbase Connector (XCC) is used to communicate between a Java application layer and MarkLogic Server using the XDBC protocol.
This section provides an overview of XCC and includes the following parts:
XCC has a set of client libraries that you use to build applications that communicate with MarkLogic Server. XCC requires that an XDBC server is configured in MarkLogic Server.
An XDBC server responds to XDBC and XCC requests. XDBC and XCC use the same wire protocol to communicate with MarkLogic Server. You can write applications either as standalone applications or ones that run in an application server environment. Your XCC-enabled application connects to a specified port on a system that is running MarkLogic Server, and communicates with MarkLogic Server by submitting requests (for example, XQuery statements) and processing the results returned by those programs. These XQuery programs can incorporate calls to XQuery functions stored and accessible by MarkLogic Server, and accessible from any XDBC-enabled application. The XQuery programs can perform the full suite of XQuery functionality, including loading, querying, updating and deleting content.
XQuery requests submitted via XCC return results as specified by the XQuery code. These results can include XML and a variety of other datatypes. It is the XCC application's responsibility to parse, process and interpret these results in a manner appropriate to the variety of datatypes available. There are a number of publicly available libraries for assisting with this task, or you may write your own code. In order to accept connections from XCC-enabled applications, MarkLogic Server must be configured with an XDBC Server listening on the designated port. Each XDBC Server connects by default to a specific database within MarkLogic Server, but XCC provides the ability to communicate with any database in the MarkLogic Server cluster to which your application connects (and for which you have the necessary permissions and privileges).
XCC communicates with MarkLogic Server with a client-server architecture, where the XCC application is the client and MarkLogic Server is the server. The following figure illustrates the high-level architecture:
As shown in the diagram above, the XCC-enabled application can run on the same system as an instance of MarkLogic Server (a host), or it can run on a completely different system, as long as the two systems are networked together.
In the diagram, the XCC application running on System A has opened an XDBC connection to port x1 on System B. On System B, MarkLogic Server is configured with an XDBC Server listening to port x1, and that XDBC Server connects to databased1. Consequently, the configuration shown in the diagram above allows the XCC application on System A to submit XQuery requests (including query, load, update and delete) for evaluation against databased1.
XCC automatically does connection pooling, so you do not need to write any connection pooling logic in your application. The XCC Session
object automatically obtains and releases connections for XCC applications as needed.
This document provides an introduction to the XCC developer libraries. For detailed API documentation for XCC and for MarkLogic Server, or to learn how to configure XDBC servers in MarkLogic Server, see the appropriate documents:
This section lists the requirements for XCC and has the following parts:
XCC requires MarkLogic Server 7.0-1 or later.
Note that not all XCC features are usable with all versions of MarkLogic Server. For example, you must have MarkLogic 8 or later to use the Server-Side JavaScript and JSON features with XCC.
XCC has the following requirements:
Note that not all XCC features are available with all versions of MarkLogic Server.
You must have MarkLogic 8 or later to use the Server-Side JavaScript and JSON features of XCC, and your classpath must include Jackson JAR files for Jackson version 2.5 or later. For more information about Jackson, see http://github.com/FasterXML/jackson.
To use XCC in an environment that includes a load balancer between MarkLogic and your XCC application, some configuration is required. For details, see Using a Load Balancer or Proxy Server with an XCC Application.