# JDBC URL Examples

> Source: https://docs.synthesized.io/tdk/latest/user_guide/010_get_started/jdbc_url
> For the complete documentation index, see [llms.txt](https://docs.synthesized.io/llms.txt).

To create a new data source, the user are to enter the `JDBC URL` parameter. This page provides standard JDBC URL formats and connection examples for supported database systems.

## PostgreSQL

For a PostgreSQL, the basic format of the connect string is:

```
jdbc:postgresql://<host>:<port>/<database>
```

Example of JDBC URL:

```
jdbc:postgresql://localhost:5432/postgres
```

More information about connecting to the PostgreSQL database can be found in the [documentation](https://jdbc.postgresql.org/documentation/use/#connecting-to-the-database).

## SQL Server

The general form of the connection URL for SQL Server is:

```
jdbc:sqlserver://<host>:<port>[;<property>=<value>]
```

Example of JDBC URL which is used to connect to `master` database without encryption:

```
jdbc:sqlserver://localhost:1433;encrypt=false;databaseName=master
```

More information about connecting to the SQL Server database can be found in the [documentation](https://learn.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver16).

## MySQL

The general form of the connection URL is:

```
jdbc:mysql://<host>:<port>[/<database>][?properties]
```

Example:

```
jdbc:mysql://localhost:3306/sakila
```

> **NOTE**
> `LOAD DATA LOCAL INFILE` requires the MySQL server (or managed instance) to allow local infile operations (`local_infile=1`). The platform automatically enables the JDBC-side property when `USE_FILE_BATCH_INSERT` is set, but you must ensure the server configuration permits it.

More information about connecting to the MySQL database can be found in the [documentation](https://dev.mysql.com/doc/connector-j/en/connector-j-reference-jdbc-url-format.html).

## Oracle

When connecting to an Oracle database using JDBC, the URL format depends on the type of connection method. Some of the connection methods are described below.

### Service Name Connection

The format of the JDBC URL to connect Oracle databases via service name:

```
jdbc:oracle:thin:@//<host>:<port>/<serviceName>
```

Example:

```
jdbc:oracle:thin:@//localhost:1521/DB
```

### TNS URL Format

`tnsnames.ora` entries can be included in the JDBC URL to connect to Oracle databases:

```
jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<host>)(PORT=<port>))(CONNECT_DATA=(SERVICE_NAME=<service>)))
```

Example:

```
jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=DB)))
```

More information about connecting to the Oracle database can be found in the [documentation](https://docs.oracle.com/en/database/oracle/oracle-database/21/jjdbc/data-sources-and-URLs.html).

## Db2

Basic URL template for Db2 (type 4 connectivity) is:

```
jdbc:db2://<host>:<port>/<database>
```

Example:

```
jdbc:db2://localhost:50000/testdb
```

More information about connecting to the Db2 database can be found in the [documentation](https://www.ibm.com/docs/en/db2/12.1?topic=cdsudidsdjs-url-format-data-server-driver-jdbc-sqlj-type-4-connectivity).

## SQLite

The general form of the connection URL for SQLite is:

```
jdbc:sqlite:<path_to_sqlite_file>
```

Example of JDBC URL with the absolute path to the SQLite database file (`test.db`):

```
jdbc:sqlite:/var/data/test.db
```

## SAP HANA

For a SAP HANA database, the basic format of the connect string is:

```
jdbc:sap://<host>:<port>/<database>
```

Example of JDBC URL:

```
jdbc:sap://ec2-35-177-245-71.eu-west-2.compute.amazonaws.com:39015
```

## CSV File

For a SAP HANA database, the basic format of the connect string is:

```
s3://<file storage>:<port>/<bucket>/<directory>
```

Example of JDBC URL:

```
s3://minio:9000/csvinput/data/
```

More information about connecting to the SQLite database can be found in the [documentation](https://www.sqlitetutorial.net/sqlite-java/sqlite-jdbc-driver/).
