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 Mailchimp 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.mailchimp.MailChimpDriver
- Provide the JDBC URL. For example:
jdbc:mailchimp:APIKey=myAPIKey; or jdbc:cdata:mailchimp:APIKey=myAPIKey;
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:mailchimp:" or "jdbc:cdata:mailchimp:" and can include any of the connection properties in name-value pairs separated with semicolons.
Connecting to Mailchimp
Mailchimp supports the following authentication methods:
- APIKey
- OAuth
API Key
The easiest way to connect to Mailchimp is to use the API Key. The APIKey grants full access to your Mailchimp account. To obtain the APIKey, log into Mailchimp and click Account -> Extras -> API Keys. You can then set the connection property APIKey to this value.
- AuthScheme: Set this to APIKey.
OAuth
An alternative method to authenticate to Mailchimp is using OAuth standard. OAuth can be used to enable other users to access their own data. To authenticate using OAuth, you need to obtain the OAuthClientId, OAuthClientSecret, and CallbackURL by registering an app with Mailchimp. OAuth requires the authenticating user to interact with Mailchimp using the browser.
- AuthScheme: Set this to OAuth.