---
sidebar_label: Java
title: Connect with Java Connector
---
## Add Dependency
Build with Maven
```xml
com.taosdata.jdbc
taos-jdbcdriver
2.0.39
```
Build with Gradle
```groovy
dependencies {
implementation 'com.taosdata.jdbc:taos-jdbcdriver:2.0.39'
}
```
## Config
Run this command in your terminal to save your url and token as variables:
```bash
export TDENGINE_CLOUD_URL=
export TDENGINE_CLOUD_TOKEN=
```
:::note
You should replace above placeholders as real values. To obtain these values, please log in TDengine Cloud and switch to "Connector" section.
:::
## Connect
```java
import com.taosdata.jdbc.TSDBDriver;
import java.sql.Connection;
import java.sql.SQLException;
public class ConnectCloudExample {
public static void main(String[] args) throws SQLException {
String url = System.getenv("TDENGINE_CLOUD_URL");
String token = System.getenv("TDENGINE_CLOUD_TOKEN");
Connection conn = TSDBDriver.connect(url, token); // demo code for discussion.
}
}
```
The client connection is then established.