JDBC Driver for MarkLogic

Build 22.0.8462

Establishing a Connection

Creating a JDBC Data Source

You can create a JDBC data source to connect from your Java application. Creating a JDBC data source based on the CData JDBC Driver for MarkLogic consists of three basic steps:

  • Add the driver JAR file to the classpath. The JAR file is located in the lib subfolder of the installation directory. Note that the .lic file must be located in the same folder as the JAR file.
  • Provide the driver class. For example:
    cdata.jdbc.marklogic.MarkLogicDriver
  • Provide the JDBC URL. For example:
    jdbc:marklogic:User='myusername';Password='mypassword';Server='marklogic'
    
    or
    
    jdbc:cdata:marklogic:User='myusername';Password='mypassword';Server='marklogic'

    The second format above can be used whenever there is a conflict in your application between drivers using the same URL format to ensure you are using the CData driver. The URL must start with either "jdbc:marklogic:" or "jdbc:cdata:marklogic:" and can include any of the connection properties in name-value pairs separated with semicolons.

Connecting to MarkLogic

Picking an API

The CData JDBC Driver for MarkLogic offers access to both the REST and ODBC APIs for MarkLogic. Please see Picking the right API for a discussion on which API is right for your use case.

Connection Details

Regardless of which API you are connecting to, you will need to include the following connection details:

  • Server - The server being connected to.
  • Database - (Optional) The specific database to connect to.
  • Port - (Optional) The specific port to use if the default port for the selected API is not being used default.

Create an ODBC Server

If connecting to the ODBC API, please follow the guide in MarkLogic's official website on how to create an ODBC Server, https://docs.marklogic.com/guide/admin/odbc.

Authenticating to MarkLogic

To authenticate to MarkLogic, specify the following connection properties:

  • User - The user to authenticate as.
  • Password - The password of the user.

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8462