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 SurveyMonkey 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:surveymonkey:InitiateOAuth=GETANDREFRESH;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackURL=http://localhost:portNumber; or jdbc:cdata:surveymonkey:InitiateOAuth=GETANDREFRESH;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;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:surveymonkey:" or "jdbc:cdata:surveymonkey:" and can include any of the connection properties in name-value pairs separated with semicolons.
SurveyMonkey uses the OAuth 2 authentication standard. The account whose surveys will be read must have a paid plan subscription, given that SurveyMonkey requires this to read survey responses.
There are two authentication methods available for connecting to SurveyMonkey:
- Using the Personal Access Token, when you are registering a private oauth application.
- Using OAuth, when you are registering a public oauth application.
Using the Personal Access Token
Use the personal token to test and to access your own data. To obtain the personal token, follow the steps found in Creating a Custom OAuth App and set the following connection properties:
- OAuthAccessToken: Set this to the AccessToken generated in your app settings.
- InitiateOAuth: Set this to OFF.
The driver is already registered with SurveyMonkey as an OAuth application. As such, it will, by default, automatically use its Embedded Credentials to connect.
If you would prefer to use your own custom OAuth app, see Custom Credentials.