> For the complete documentation index, see [llms.txt](https://v2.dataos.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://v2.dataos.info/concepts/resources/depot/supported-sources/jdbc.md).

# Java Database Connectivity (JDBC)

To create a JDBC Depot, you must have the following details:

## Pre-requisites specific to DataOS

To create a Depot, you need the Data Admin role. Contact the DataOS Operator or Tenant Admin to get it.

Run this command to see your assigned roles.

```bash
dataos-ctl user get
#Expected Output: 
time="2026-03-30T17:49:18+05:30" level=info msg="😃 user get..."
time="2026-03-30T17:49:19+05:30" level=info msg="😃 user get...complete"

     NAME     │        ID         │  TYPE  │        EMAIL         │                  TAGS
──────────────┼───────────────────┼────────┼──────────────────────┼────────────────────────────────────────
 I Am Groot   │ iamgroottmdcio    │ person │ iam.groot@tmdc.io    │ roles:id:ct-onboarding-data-developer,
              │                   │        │                      │ roles:id:data-dev,
              │                   │        │                      │ roles:id:system-dev,
              │                   │        │                      │ roles:id:user,
              │                   │        │                      │ users:id:iamgroottmdcio

```

## Pre-requisites specific to the source system

* **Database Name**: The name of the database you want to connect to. This can be provided by the database administrator or found in the database management interface, where your desired database is listed.
* **Subprotocol Name**: The subprotocol specifies the type of database you are connecting to, such as `mysql`, `postgresql`, etc. This should match the JDBC driver you're using to establish the connection, and can typically be found in the documentation of the specific database or JDBC driver.
* **Hostname/URL of the Server**: The hostname or URL of the server where the database is hosted. This is typically provided by the database administrator or hosting service, and points to the location of your database.
* **Port**: The port number through which the database connection is made (e.g., `3306` for MySQL, `5432` for PostgreSQL). This information can also be obtained from the database administrator or found in the configuration of the database server.
* **Parameters**: Any additional connection parameters needed for the JDBC connection, such as SSL settings, timeouts, or specific options for the database connection. These can be found in the JDBC driver documentation or obtained from the database administrator if custom configurations are required.
* **Username**: The username used to authenticate the JDBC connection. This can be provided by the database administrator or set when the user account is created in the database management system.
* **Password**: The password associated with the provided username. This is typically set when the user account is created and must be securely stored or retrieved from a safe location if forgotten.

## Create a JDBC Depot

A Depot of type `JDBC` connects to a database through the JDBC driver and reads from its tables. One Depot covers all schemas visible to the configured user. To create a Depot of type `JDBC`, follow these steps:

### **Step 1: Create a Secret for securing JDBC credentials**

Create a Secret Resource using the [Java Database Connectivity (JDBC)](/concepts/resources/secret/data-sources/java-database-connectivity-jdbc.md) guide.

### **Step 2: Create a JDBC Depot manifest file**

Create a manifest file for your JDBC Depot.

{% tabs %}
{% tab title="Manifest file" %}

```yaml
name: ${{name}}
version: v2alpha
type: depot
tags:
  - ${{tag-1}} # optional

owner: ${{owner-name}}
layer: user
description: ${{description}}
spec:
  type: jdbc                                      
  description: ${{source-description}} # optional
  secrets:
    - id: "${{tenant-id}}:${{secret-name}}"
      purpose: scan
    - id: "${{tenant-id}}:${{secret-name}}"
      purpose: query
    - id: "${{tenant-id}}:${{secret-name}}"
      purpose: rw
  spec:
    subprotocol: ${{subprotocol}} # mandatory
    host: ${{host}} # mandatory
    port: ${{port}} # mandatory
    database: ${{database-name}} # optional
    params: # optional
      ${{key-1}}: ${{value-1}}
      ${{key-2}}: ${{value-2}}
```

{% endtab %}

{% tab title="Example" %}

```yaml
version: v2alpha
name: jdbc
type: depot
description: "Generic JDBC depot for relational sources"
tags:
  - JDBC
  - depot
  - rdbms
layer: user
spec:
  type: jdbc
  spec:
    subprotocol: "postgresql"
    host: ${{jdbc-host}}
    port: ${{jdbc-port}}
    database: ${{jdbc-database}}
    params:
      sslmode: disable
  secrets:
    - id: "${{tenant-id}}:${{jdbc-secret-name}}"
      purpose: scan
    - id: "${{tenant-id}}:${{jdbc-secret-name}}"
      purpose: query
    - id: "${{tenant-id}}:${{jdbc-secret-name}}"
      purpose: rw
```

{% endtab %}
{% endtabs %}

### **Step 3: Apply the Depot manifest file**

Apply the manifest with the DataOS CLI:

```bash
dataos-ctl resource apply -f ${{manifest-file-path}}
```

## Verify the Depot creation

Verify the Depot in two ways:

* List Depots where you are the owner:

  ```bash
  dataos-ctl resource get -t depot
  ```
* List all Depots in the current Tenant:

  ```bash
  dataos-ctl resource get -t depot -a
  ```

## Delete a Depot

{% hint style="warning" %}
Best practice: Delete Resources that are no longer in use to save time and reduce costs.
{% endhint %}

To delete a Depot, use the DataOS CLI:

{% tabs %}
{% tab title="Command 1" %}

```bash
dataos-ctl resource delete -t depot -n ${{name}}
```

{% endtab %}

{% tab title="Command 2 " %}

```bash
dataos-ctl resource delete -i "${{resource-name}}|v2alpha|depot"
```

{% endtab %}

{% tab title="Command 3" %}

```bash
dataos-ctl resource delete -f ${{manifest-file-path}}
```

{% endtab %}
{% endtabs %}

Specify the Resource type and Depot name in the `delete` command.

**Example:**

{% tabs %}
{% tab title="Command 1" %}

```bash
dataos-ctl resource delete -t depot -n testdepot
#output
time="2026-03-25T15:53:55+05:30" level=info msg="🗑 delete..."
time="2026-03-25T15:53:55+05:30" level=info msg="🗑 deleting testdepot:v2alpha:depot..."
time="2026-03-25T15:53:56+05:30" level=info msg="🗑 deleting testdepot:v2alpha:depot...deleted"
time="2026-03-25T15:53:56+05:30" level=info msg="🗑 delete...complete"
time="2026-03-25T15:53:56+05:30" level=info msg="🗑 delete...complete"
```

{% endtab %}

{% tab title="Command 2" %}

```bash
dataos-ctl resource delete -i "testdepot|v2alpha|depot"
#output
time="2026-03-25T15:55:37+05:30" level=info msg="🗑 delete..."
time="2026-03-25T15:55:37+05:30" level=info msg="🗑 deleting testdepot:v2alpha:depot..."
time="2026-03-25T15:55:37+05:30" level=info msg="🗑 deleting testdepot:v2alpha:depot...deleted"
time="2026-03-25T15:55:37+05:30" level=info msg="🗑 delete...complete"
```

{% endtab %}

{% tab title="Command 3" %}

```bash
dataos-ctl resource delete -f /path/to/depot.yaml
#output
time="2026-03-25T15:53:55+05:30" level=info msg="🗑 delete..."
time="2026-03-25T15:53:55+05:30" level=info msg="🗑 deleting testdepot:v2alpha:depot..."
time="2026-03-25T15:53:56+05:30" level=info msg="🗑 deleting testdepot:v2alpha:depot...deleted"
time="2026-03-25T15:53:56+05:30" level=info msg="🗑 delete...complete"
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://v2.dataos.info/concepts/resources/depot/supported-sources/jdbc.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
