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.

OAuth 2.0 access token authentication

Connection conn = DriverManager.getConnection
  ("jdbc:datadirect:hubspot:AuthenticationMethod=OAuth2;
    AccessToken=abcDEF123ghi-456Jklmno789-Pqrst01234;");

OAuth 2.0 refresh token authentication

Connection conn = DriverManager.getConnection
  ("jdbc:datadirect:hubspot:AuthenticationMethod=oauth2;
    ClientID=ab123c45-def6-7g89-gh1i-m2345no67891;
    ClientSecret=12a3=bCD/EfGh4Ijk+Lm5P67qR8s=//TuV+WXy1Zabcd;
    RefreshToken=12a3=bCD/EfGh4Ijk+Lgd8g-44tk3c527831;");
Note: See OAuth 2.0 authentication for details.
API key authentication
Connection conn = DriverManager.getConnection
("jdbc:datadirect:hubspot:AuthenticationMethod=URLParameter;
  APIKey=1234ab5cd-1a2b-3a4b-678uvw-xyz91011;");
Note: See API key authentication for details.