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 SugarCRM 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.sugarcrm.SugarCRMDriver
- Provide the JDBC URL. For example:
jdbc:sugarcrm:InitiateOAuth=GETANDREFRESH;URL=http://mySugarCRM.com;User=myUser;Password=myPassword; or jdbc:cdata:sugarcrm:InitiateOAuth=GETANDREFRESH;URL=http://mySugarCRM.com;User=myUser;Password=myPassword;
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:sugarcrm:" or "jdbc:cdata:sugarcrm:" and can include any of the connection properties in name-value pairs separated with semicolons.
Connecting to SugarCRM
To establish a connection to SugarCRM, set URL to the URL associated with your SugarCRM account in the form http://{sugar crm instance}.com.
Authenticating to SugarCRM
To authenticate the driver to SugarCRM, set the following:
- User: The user of the SugarCRM account.
- Password: The password associated with the SugarCRM user.
- Platform (optional): If you're encountering a login conflict during authentication, set this to one of the platforms that you have created in the SugarCRM UI.
By default, SugarCRM uses the "sugar" client id for authentication, but users can optionally specify the client Id and client secret values of a custom app. See Creating a Custom OAuth Application for more information.
- OAuthClientId: Client Id of your custom OAuth app.
- OAuthClientSecret: Client secret of your custom OAuth app.
Caching SugarCRM Metadata
Note that retrieving SugarCRM metadata can be expensive. It is advised that you store the metadata locally as described in Caching Metadata.