XCC Sessions
XCC programs use the Session
interface to set up and control communication with MarkLogic Server. XCC automatically creates and releases connections to MarkLogic Server as needed, and automatically pools the connections so that multiple requests are handled efficiently.
A Session
handles authentication with MarkLogic Server and holds a dynamic state, but it is a lightweight object. It is OK to create and release Session objects as needed and as makes logical sense for your program. Do not expend effort to pool and reuse them, however, because they are not expensive to create. For example, if your program is doing multiple requests one after another, create a Session
object at the beginning and close it when the last request is complete.
You set up the connection details with the ContentSource
object. You can submit the connection details when you invoke the XCC program with a URL that has the following form:
xcc://username:password@host:port/database
Also, there are discrete arguments to the constructors in the API to set up any or all portions of the connection details.