Java API basics
You're back! Let's dive in. The first step to interacting with a MarkLogic database is to create an instance of the DatabaseClient class. Each of the example programs in this tutorial start with a step that looks something like this.
Notice the arguments passed to the factory method. As seen in the online javadoc for the newClient() method, these correspond to:
host
— the host with the REST serverport
— the port for the REST serveruser
— the user with read, write, or administrative privilegespassword
— the password for the usertype
— the type of authentication applied to the request
For all of the sample apps in the project you downloaded, these parameters are configured using the Config.properties file:
If you want to see how the tutorial project extracts these properties, see its Config.java file.
Once you're done interacting with MarkLogic, you should always release the DatabaseClient:
The rest of this tutorial is about the things you might do in between creating the DatabaseClient and releasing it.
Setup
CRUD