skip to main content
Quick Start: Accessing REST data sources using HTTP header authentication : Connecting to a DataSource : Connecting using the DriverManager : 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
For sessions using a REST file (sessions with multiple endpoints, PUSH requests, or paging):
jdbc:datadirect:autorest://servername;AuthenticationMethod=HttpHeader;
Config=rest_file_path;SecurityToken=token;
User=user_name;[property=value[;...]];
For sessions using the Sample property:
jdbc:datadirect:autorest:AuthenticationMethod=HttpHeader;
Sample=sample_path;SecurityToken=token;User=user_name;
[property=value[;...]];
where:
servername
optionally, specifies the host name portion of the HTTP endpoint to which you send requests. Specify this value 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.
token
specifies the security token required to make a connection to your REST API endpoint.
user_name
specifies the user name used to access your endpoint, if required.
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.
The following examples demonstrate a URLs for sessions using HTTP header authentication:
For sessions using a REST file:
Connection conn = DriverManager.getConnection
("jdbc:datadirect:autorest:https://api.mysite.com/;
AuthenticationMethod=HttpHeader;Config=C:/path/to/mysite.rest;
SecurityToken=XaBARTsLZReM;User=jsmith;");
For sessions using the Sample property:
Connection conn = DriverManager.getConnection
("jdbc:datadirect:autorest:AuthenticationMethod=HttpHeader;
Sample=https://api.mysite.com/countries/get/all;SecurityToken=XaBARTsLZReM;
User=jsmith;");