skip to main content
Quick Start: Accessing REST data sources using basic 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, POST requests, or paging):
jdbc:datadirect:autorest:servername;AuthenticationMethod=basic;
Config=rest_file_path;User=user_name;Password=password;
[property=value[;...]];
For sessions using the Sample property:
jdbc:datadirect:autorest:AuthenticationMethod=basic;Sample=sample_path;
User=user_name;Password=password;[property=value[;...]];
where:
servername
(optional), 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.
user_name
specifies the user name used to access your endpoint.
password
specifies the password used to access your endpoint.
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 basic authentication:
For sessions using a REST file:
Connection conn = DriverManager.getConnection
("jdbc:datadirect:autorest:https://api.mysite.com/;
AuthenticationMethod=basic;Config=C:/path/to/mysite.rest;
User=jsmith;Password=secret;");
For sessions using the Sample property:
Connection conn = DriverManager.getConnection
("jdbc:datadirect:autorest:AuthenticationMethod=basic;
Sample=https://api.mysite.com/countries/get/all;User=jsmith;Password=secret;");