After setting the CLASSPATH, the required connection information needs to be passed in the form of a connection URL. The following example includes the properties required for connecting with OAuth 2.0 authorization code grant authentication.

Connection URL Syntax

The connection URL takes the following form:

jdbc:datadirect:aha:servername;AuthenticationMethod=OAuth2;
ClientID=client_id;ClientSecret=client_secret;RedirectURI=redirect_uri;
[property=value[;...]];

where:

serviceurl
specifies the base URL of the Aha! service to which you want to issue requests. For example, example.org.
client_id
specifies the client ID key for your application when authenticating with OAuth 2.0.
client_secret
specifies the client secret for your application when authenticating with OAuth 2.0.

Important: The client secret is a confidential value used to authenticate the application to the server. To prevent unauthorized access, this value must be securely maintained.

redirect_uri
specifies the endpoint that the client is returned to after authenticating with the service.
property=value
specifies connection property settings. Multiple properties are separated by a semi-colon.

Connection URL Example

Connection conn = DriverManager.getConnection
  ("jdbc:datadirect:aha://example.org;authenticationMethod=OAuth2;
    oauthCode=abc12cd34efg5678h9ij87klm6543no32pqr10;
    clientId=cd34efg5678h9ij87klm6543no32pqr10st987;
    clientSecret=098zyx765wvu432tsr123qpo456;
    redirectUri=https://lvh.me/app_callback.html;");