Establishing a Connection
Creating a JDBC Data Source
You can create a JDBC data source to connect from your Java application. Creating a JDBC data source based on the CData JDBC Driver for Basecamp consists of three basic steps:
- Add the driver JAR file to the classpath. The JAR file is located in the lib subfolder of the installation directory. Note that the .lic file must be located in the same folder as the JAR file.
- Provide the driver class. For example:
- Provide the JDBC URL. For example:
jdbc:basecamp:InitiateOAuth=GETANDREFRESH;AccountId=1234567;Schema=V3;ProjectId=abcd1234 or jdbc:cdata:basecamp:InitiateOAuth=GETANDREFRESH;AccountId=1234567;Schema=V3;ProjectId=abcd1234
The second format above can be used whenever there is a conflict in your application between drivers using the same URL format to ensure you are using the CData driver. The URL must start with either "jdbc:basecamp:" or "jdbc:cdata:basecamp:" and can include any of the connection properties in name-value pairs separated with semicolons.
Connecting to Basecamp
In addition to authenticating, set the following connection properties to access Basecamp tables.
- Schema: Set this to "V2" or "V3" to connect to a Basecamp 2 or Basecamp 3 account.
- ProjectId: This is a required parameter for most table operations. You can query the Projects table to obtain this value.
If you do not specify the ProjectId connection property, the driver will use the first project Id returned from the Projects table in your first authentication to Basecamp.
- AccountId: You can find the AccountId in the URL after you log in to Basecamp in a web browser:
Authenticating to Basecamp
Basecamp 2 uses basic or OAuth 2.0 authentication. You can use basic authentication to connect to your own account, or you can use OAuth to enable other users to log into their own accounts.
Basecamp 3 requires OAuth 2.0.
Authenticate via Basic Authentication
In basic authentication, you use your login credentials to connect. Set the following properties:
- User: This is the username you use to log in to Basecamp.
- Password: This is the password you use to log in to Basecamp.
- AuthScheme: Set this to Basic.
Authenticate via OAuth Authentication
To use OAuth, set the AuthScheme to OAuth.
See Using OAuth Authentication for an authentication guide.