Skip to content

Functions: Manage connections

Loren Cahlander edited this page Jun 10, 2019 · 12 revisions

For the following functions a user must be DBA or member of the group couchebase.

connect

couchbase:connect($connection as xs:string) as xs:string
couchbase:connect($connection as xs:string, $bucketPassword as xs:string) as xs:string

Connect to Couchbase server. Returns the identifier clusterId of the cluster connection, to be used in subsequent calls. The (not mandatory) password is used for document operations in the buckets.

The Couchbase username is the same username from the XQuery context within eXist-db. The user must be a member of either the dba or the couchbase groups within eXist-db.

For performance reasons, the class CouchbaseEnvironment is used, as recommended in the documentation (paragraph Sharing Resources).

The connection string URL has the format of <url scheme>://<hostname>:<portnr?

The other supported URL schemes are couchbase, couchbases (SSL secured connections) and http.

close

couchbase:close($clusterId as xs:string) as empty()

Close and shutdown the Couchbase connection.

list-cluster-ids

couchbase:list-cluster-ids() as xs:string*

Get all Couchbase clusterIds.

connection-report

couchbase:connection-report()

Get report on active connections

shutdown

couchbase:shutdown()

Shutdown all connections and the environment.

note: needs rework

Example

For examples see the junit test

Clone this wiki locally