Salesforce JDBC driver allows Java programs to connect to Salesforce data services using standard, database independent Java code. It is an open source JDBC driver written in Pure Java, and communicates over SOAP/HTTP(S) protocol.
The main purpose of the driver is to retrieve (only) data from Salesforce services for data analysis. Primary target platform for the driver usage is Eclipse BIRT engine.
The current version of the driver should be compatible with Salesforce Partner API version 39.0 and higher and Java 8.
Download the driver here
<repositories>
<repository>
<id>com.ascendix.maven</id>
<name>Ascendix Maven Repo</name>
<url>https://github.com/ascendix/mvnrepo/raw/master</url>
</repository>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
</repositories>
<dependency>
<groupId>com.ascendix.salesforce</groupId>
<artifactId>salesforce-jdbc</artifactId>
<version>1.1-20180403.104727-1</version>
</dependency>
com.ascendix.jdbc.salesforce.ForceDriver
jdbc:ascendix:salesforce://[;propertyName1=propertyValue1[;propertyName2=propertyValue2]...]
There are two ways to connect to Salesforce:
- by using user and password;
- by using sessionId.
User and password parameters are ignored if sessionId parameter is set.
An example for a connection URL with user and password parameters:
jdbc:ascendix:salesforce://;user=myname@companyorg.com.xre.ci;password=passwordandsecretkey
An example for a connection URL with sessionId parameter:
jdbc:ascendix:salesforce://;sessionId=uniqueIdAssociatedWithTheSession
Property | Description |
---|---|
user | Login username. |
password | Login password is associated with the specified username. Warning! A password provided should contain your password and secret key joined in one string. |
sessionId | Unique ID associated with this session. |
loginDomain | Top-level domain for a login request. Default value is login.salesforce.com. Set test.salesforce.com value to use sandbox. |
https | Switch to use HTTP protocol instead of HTTPS Default value is true |
api | Api version to use. Default value is 50.0. Set test.salesforce.com value to use sandbox. |
client | Client Id to use. Default value is empty. |
- Queries support native SOQL;
- Nested queries are supported;
- Request caching support on local drive. Caching supports 2 modes: global and session. Global mode means that the cached result will be accessible for all system users for certain JVM session. Session cache mode works for each Salesforce connection session separately. Both modes cache stores request result while JVM still running but no longer than for 1 hour. The cache mode can be enabled with a prefix of SOQL query. How to use: =======
- Global cache mode:
CACHE GLOBAL SELECT Id, Name FROM Account
- Session cache mode
CACHE SESSION SELECT Id, Name FROM Account
- The driver is only for read-only purposes now. Insert/udate/delete functionality is not implemented yet.
-
How to set configuration properties for Salesforce JDBC driver.
Birt provides various ways to set parameters for JDBC driver. For example, it can be done with the property binding feature in the data source editor and a report parameter.
See how it's done in [Salesforce JDBC report sample](docs/birt/Salesforce JDBC sample.rptdesign)