Establishing a Connection
Creating a JDBC Data Source
You can create a JDBC data source to connect from your Java application, based on CData JDBC Driver for SugarCRM.Follow these steps:
- Add the driver JAR file to the classpath. The JAR file is located in the installation directory's lib subfolder. Ensure that the .lic file is 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, if there is a conflict in your application between drivers using the same URL format, use this form to ensure that you are using the CData driver:
jdbc:cdata:sugarcrm:InitiateOAuth=GETANDREFRESH;URL=http://mySugarCRM.com;User=myUser;Password=myPassword;
Ensure that the URL starts with either jdbc:sugarcrm: or jdbc:cdata:sugarcrm:. The URL 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.