Passing the connection URL
- Last Updated: May 13, 2025
- 1 minute read
- DataDirect Connectors
- JDBC
- GitHub 6.0
- Documentation
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 authentication.
Connection URL Syntax
The connection URL takes the following form:
jdbc:datadirect:github:ServerName=server_name;AuthenticationMethod=method;
AccessToken=access_token;[property=value[;...]];
where:
- server_name
- specifies the base URL of the GitHub instance to which you want to issue requests. For example, api.github.com for cloud accounts and github.enterprise.com for enterprise accounts.
- method
- specifies the authentication method used to connect to the service.
AuthenticationMethod should be set to
OAuth2for OAuth 2.0 authentication.
- access_token
- Specifies the access token used to authenticate to GitHub when OAuth 2.0 authentication is enabled.
- scope
- (optional) specifies a space-separated list of OAuth scopes that limit the permissions granted by an access token.
- property=value
- specifies connection property settings. Multiple properties are separated by a semi-colon.
The following example connection string includes the properties required for connecting with the OAuth 2.0 authentication.
Connection conn = DriverManager.getConnection
("jdbc:datadirect:github:
ServerName=api.github.com;DefaultQueryOptions=OrgName=Org1;
UserName=user1;RepoName=Repo1;);AuthenticationMethod=OAuth2;
AccessToken=12a3=bCD/EfGh4Ijk+Lgd8g-44tk3c527831;");
Note: The DefaultQueryOption
connection property is optional.