SQL DB Connection Strings
Here are formats and examples of connection strings used by multiple supported relational databases.
PostgreSQL
Use the connection string of the following form:
jdbc:postgresql://<host>:<port>/<database>[?property=value]
Substitute <host>
, <port>
, and <database>
as required. A number of additional properties is supported. To learn more, see PostgreSQL documentation.
Example
jdbc:postgresql://postgres.db.server:5432/my_database
Oracle
Use the connection string in one of the following forms:
jdbc:oracle:thin:@//<host>:<port>/<service_name>
A connection string using the key=value
format:
jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(host=<host>)(protocol=<protocol>)(port=<port>))(CONNECT_DATA=(SERVICE_NAME=<service_name>)))
Substitute <host>
, <protocol>
, <port>
, and <service_name>
as required. If you do not enter a service name the default service name is used. A number of additional properties is supported.
Examples
jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(HOST=myoracle.db.server)(PROTOCOL=TCP)(PORT=5432))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)))
jdbc:oracle:thin:@//myoracle.db.server:5432/MyOracleSID
MySQL
Use the connection string in one of the following forms:
jdbc:mysql://<host>:<port>/<database>[?properties]
A connection string using the key=value
format:
jdbc:mysql://(host=<host>,port=<port>,[property=value])/<database>
Substitute <host>
, <port>
, and <database>
as required. A number of additional properties is supported. To learn more, see MySQL documentation.
Examples
jdbc:mysql://mysql.db.server:5432/my_database
jdbc:mysql://(host=mysql.db.server,port=1111)/my_database
Microsoft SQL
Use the connection string of the following form:
jdbc:sqlserver://<host>:<port>;databaseName=<database_name>[;property=value]
Substitute <host>
, <port>
, and <database_name>
as required. A number of additional properties is supported. To learn more, see Microsoft SQL documentation.
Example
jdbc:sqlserver://localhost:5432;databaseName=my_database;
Apache Druid
You can make Druid SQL queries using the Avatica JDBC driver. Use the connection string of the following form:
jdbc:avatica:remote:url=http://<host>:<port>/druid/v2/sql/avatica/
Substitute <host>
and <port>
as required. Note that the ending slash is needed. To learn more, see Apache Druid documentation.
Example
jdbc:avatica:remote:url=http://my.druid.db:5432/druid/v2/sql/avatica/
Vertica DB
Use the connection string of the following form:
jdbc:vertica://<host>:<port>/<database>[?property=value]
Substitute <host>
, <port>
, and <database>
as required. A number of additional properties is supported. To learn more, see Vertica DB documentation.
Example
jdbc:vertica://my.vertica.db:5432/my_database?user=username&password=password
Snowflake
Use the connection string of the following form:
jdbc:snowflake://<account_identifier>.snowflakecomputing.com/[?properties]
Substitute <account_identifier>
for your Snowflake account identifier. For details, see Account Identifiers in the Snowflake documentation. Also see Snowflake documentation to learn more about additional connection properties.
Example
jdbc:snowflake://myaccount.snowflakecomputing.com/