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 Tableau CRM Analytics 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:
cdata.jdbc.tableaucrm.TableauCRMDriver
- Provide the JDBC URL. For example:
jdbc:tableaucrm:InitiateOAuth=GETANDREFRESH;OAuthClientId=MyConsumerKey;OAuthClientSecret=MyConsumerSecret;CallbackURL=http://localhost:portNumber or jdbc:cdata:tableaucrm:InitiateOAuth=GETANDREFRESH;OAuthClientId=MyConsumerKey;OAuthClientSecret=MyConsumerSecret;CallbackURL=http://localhost:portNumber
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:tableaucrm:" or "jdbc:cdata:tableaucrm:" and can include any of the connection properties in name-value pairs separated with semicolons.
Tableau CRM uses the OAuth 2 authentication standard. You will need to obtain the OAuthClientId and OAuthClientSecret by registering an app with Tableau CRM. See our authentication guide in Connecting to Tableau CRM. See our authentication guide in Connecting to Tableau CRM.
OAuthJWT Certificates
Set the AuthScheme to OAuthJWT.
OAuthJWT
To obtain the OAuthJWT consumer key:
- Log in to Salesforce.com.
- From Setup, enter Apps in the Quick Find box and then click the link to create an app. In the Connected Apps section of the resulting page, click New.
- Enter a name to be displayed to users when they log in to grant permissions to your app, along with a contact Email address.
- Click Enable OAuth Settings and enter a value in the Callback URL box. Set this value only to create the Connected App as it is required. It will
not actually be needed for this type of authentication. The Callback URL is in the format:
http://localhost:8019/src/oauthCallback.rst
- Enable Use digital signatures.
- Upload your certificate.
- Select the scope of permissions that your app should request from the user.
- Click your app name to open a page with information about your app. The OAuth consumer key is displayed.
After creating your OAuth Application, set the following connection properties:
- AuthScheme: Set to OAuthJWT.
- InitiateOAuth: Set to GETANDREFRESH.
- OAuthJWTCert: Set this to the JWT Certificate store.
- OAuthJWTPassword: Set this to the Password of the JWT Certificate store.
- OAuthJWTIssuer: Set this to the OAuth Client ID.
- OAuthJWTCertType: Set this to the type of the certificate store specified by OAuthJWTCert.
Note: This flow never issues a refresh token.