skip to main content
Using the driver : Authentication : Basic authentication
  

Try DataDirect Drivers Now

Basic authentication

To configure the driver to use basic authentication:
*Configure the minimum properties required for a connection:
*If you are using a REST file, set the Config property to provide the name and location of the input REST file. For example, C:/path/to/myrest.rest.
*If you are using the Sample property, set the Sample property to specify the endpoint that the want to connect to and sample. For example, https://example.com/countries/.
*Set the AuthenticationMethod property to Basic.
*Set the AuthHeader property to specify the name of the HTTP header used for authentication. The default is Authorization.
*Set the User property to specify your logon ID.
*Set the Password property to specify your password.
*Optionally, specify values for any additional properties you want to configure.
The following examples demonstrate a session using a REST file with basic authentication enabled and AuthHeader set to the default.
For a connection URL:
Connection conn = DriverManager.getConnection
("jdbc:datadirect:autorest:https://example.com/;AuthenticationMethod=basic;
Config=C:/path/to/myrest.rest;User=jsmith;Password=secret;");
For a data source:
AutoRESTDataSource mds = new AutoRESTDataSource();
mds.setDescription("My Autonomous REST Data Source");
mds.setAuthenticationMethod("Basic");
mds.setConfig("C:/path/to/myrest.rest");