skip to main content
Using the driver : Connecting from an application : Connecting using the JDBC Driver Manager : Passing the connection URL
  

Try DataDirect Drivers Now
Passing the connection URL
After setting the CLASSPATH, the required connection information needs to be passed in the form of a connection URL. The form of the connection URL differs depending on whether you are using a REST file.

Connection URL Syntax

For sessions using a REST file (sessions that use multiple endpoints, POST requests, or other customizations supported by the input REST file):
("jdbc:datadirect:autorest://servername;Config=rest_file_path;[property=value[;...]];")
For sessions using the Sample property:
("jdbc:datadirect:autorest:Sample=sample_path;[property=value[;...]];")
where:
servername
optionally, specifies the host name portion of the HTTP endpoint to which you send requests. Specify this value only if you want to define endpoints without the web server address in the REST config file.
rest_file_path
specifies the name and location of the input REST file that contains a list of endpoints to sample, PUSH request definitions, and configuration information. See "Creating an input REST file" for details.
property=value
specifies connection property settings. Multiple properties are separated by a semi-colon.
sample_path
specifies the endpoint the sample when not using a REST file.

Connection URL Example

For sessions using a REST file:
Connection conn = DriverManager.getConnection
("jdbc:datadirect:autorest:https://example.com/;Config=C:\path\to\myrest.rest;");
For sessions using the Sample property:
Connection conn = DriverManager.getConnection
("jdbc:datadirect:autorest:Sample='https://example.com//countries/get/all';");