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 Bearer Token authentication.

Connection URL Syntax

The connection URL takes the following form:

jdbc:datadirect:teamcity:ServerName=server_name;AuthenticationMethod=BearerToken;
SecurityToken=security_token;[property=value[;...]];

where:

server_name
specifies the base URL of the TeamCity instance to which you want to issue requests. For example, https://teamcity.company.com for enterprise accounts.
security_token
Specifies the security token used to authenticate to TeamCity when Bearer Token authentication is enabled.

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

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 Bearer Token authentication.

Connection conn = DriverManager.getConnection
("jdbc:datadirect:teamcity:ServerName=https://teamcity.company.com;
AuthenticationMethod=BearerToken;SecurityToken=12a3=bCD/4tk3c527831;");