One way to connect to a service is through the JDBC DriverManager using the DriverManager.getConnection() method. As the following examples show, this method specifies a string containing a connection URL.

Note: The DefaultQueryOption connection property is optional.

Basic authentication

Connection conn = DriverManager.getConnection
  ("jdbc:datadirect:github:ServerName=api.github.com;DefaultQueryOptions=(OrgName=xyz;
  UserName=abc;RepoName=RN1;ProjectId=123;ColumnId=CID1;);
  AuthenticationMethod=Basic;User=jsmith;Password=secret;");
Note: See Basic authentication for details.

OAuth 2.0 access token grant

Connection conn = DriverManager.getConnection
  ("jdbc:datadirect:github:ServerName=api.github.com;DefaultQueryOptions=(OrgName=xyz;
  UserName=abc;RepoName=RN1;ProjectId=123;ColumnId=CID1;);AuthenticationMethod=OAuth2;
  AccessToken=12a3=bCD/EfGh4Ijk+Lgd8g-44tk3c527831;");
Note: See OAuth 2.0 authentication for details.