---
title: "Custom Integrations with JDBC"
canonical: "https://help.agiloft.com/space/HELP/43718644/Custom+Integrations+with+JDBC"
format: markdown
---
You can connect Agiloft CLM to external systems and databases with the generic JDBC driver. The driver acts as a wrapper for the [REST - Search](https://agiloft-public.atlassian.net/wiki/spaces/HELP/pages/43717730) operation.

> ℹ️ **Prerequisites**
> ℹ️ 
> ℹ️ - API services are available with the new Platform edition of Agiloft CLM, but on older editions, they require either an Advanced or Premium edition.
> ℹ️ - [Contact Support](https://agiloft-public.atlassian.net/wiki/spaces/HELP/pages/43716690) to get the latest version of the Agiloft JDBC driver.

# JDBC Driver

The JDBC driver can be used with any application that supports JDBC connections. It only supports SELECT SQL operations.

## Connection Configuration

To connect to Agiloft CLM using the JDBC driver, configure the driver class and JDBC connection URL.

- driver class name: com.agiloft.jdbc.adapter.Agiloftdriver
- URL for connection: jdbc:agiloft:schema.https={is_https};schema.loginDomain={server_url};schema.kb={KB_name};schema.user={user_name};schema.password={password}

Connection parameters: 

- is_https: true if the connection is through HTTPS, false otherwise
- server_url: address of the server (if HTTPS is used, there is no need to add port 443)
- KB_name: name of the Agiloft CLM KB
- user_name: login for the user account
- password: password for user account

For example: `jdbc:agiloft:schema.https=true;schema.loginDomain=example.agiloft.com;schema.kb=Demo;schema.user=admin;schema.password=qwerty`

> ⚠️ For subtables, the table name must be placed inside quotation marks (""). Post-processing of query conditions is done using [Apache Calcite](https://calcite.apache.org/docs/reference.html). Make sure to measure acceptable performance early, especially if you use operators, Calcite functions, or a combination of the two. Note that this post-processing does not support fields whose logical name begins with an underscore (_), and if you have any such fields, you need to transfer their contents to a supported field in order to use this method.
> ⚠️ 
> ⚠️ Take care when using the following:
> ⚠️ 
> ⚠️ - **Linked Fields**: The fields returned by the generate field documentation feature or the EWTable() API include linked fields. These are advanced relationship fields that involve validation and optional values (composites) and cannot be extracted via JDBC.
> ⚠️ - **Composites**: Linked fields are composites, meaning they consist of multiple individual values that are indirectly accessible. For example, product_to_contacts is a composite of _1880_full_name, creator_login, and creator_team.
> ⚠️ - **Non-Selectable Columns**: Columns with names starting with an underscore (_) or named history are not selectable.
> ⚠️ - **Labeled Fields**: Fields labeled as “Created By” or “Updated By” (where the column name starts with an underscore) can be found using the creator_login and updater_login values (with details like full name, etc., found in the contacts table).

The following Java example uses the JDBC driver to connect to Agiloft CLM and run a query:

##### **Java Example**

```java
public class DriverUsecase { 
    public static void main(String[] args) throws SQLException { 
         String url = "jdbc:agiloft:schema.https=true;schema.loginDomain=sandbox2.agiloft.com;schema.kb=Demo;schema.user=admin;schema.password=qwerty"; 
         Connection connection = DriverManager.getConnection(url); 
  String sql = "select count(*) from company"; 
PreparedStatement statement = connection.prepareStatement(sql); 
 
ResultSet rs = statement.executeQuery(); 
while (rs.next()) { 
    int value = rs.getInt(1); 
    System.out.println("count(*) of company = " + value); 
} 
   } 
} 
```

Here's an example using Python instead:

##### **Python Example**

```python
import os
import jaydebeapi

def run_sql(sql):
    '''Sample function to run SQL query'''     driver_class = 'com.agiloft.jdbc.adapter.AgiloftDriver'
    jar_file = 'C:\\agiloft-jdbc-driver.jar' 
    jdbc_url = ("jdbc:agiloft:schema.https=false;schema.loginDomain=sandbox2.agiloft.com;"
                "schema.kb=Demo;schema.user=admin;schema.password=qwerty")
    conn = jaydebeapi.connect(jclassname=driver_class, url=jdbc_url, jars=jar_file)
    cursor = conn.cursor()
    cursor.execute(sql)
    return cursor.fetchall()

company_count = run_sql("select count(*) from company")[0][0]
print("Total companies = %s" % (company_count,))
```

#### Related articles

> Macro (contentbylabel)