The Salesforce JDBC driver enables Java applications to connect to Salesforce data services using standard, database-independent Java code. It is an open-source JDBC driver written in pure Java that communicates over the SOAP/HTTP(S) protocol.
The primary purpose of this driver is to retrieve data from Salesforce services for data analysis. It is particularly optimized for use with the Eclipse BIRT engine.
This project is a fork of the original repository, which had compatibility issues with IntelliJ IDEA. This version addresses those limitations by implementing:
- Table and column name filtering
- Case-insensitive handling for table and column names
- Metadata support for queries, allowing IntelliJ to correctly process results
- Salesforce Partner API: Version 64.0
- Java: Java 17
You can download the latest driver JAR file from the Releases page.
-
Native SOQL Queries
SELECT Id, Account.Name, Owner.Id, Owner.Name FROM Account; -- The * wildcard expands to the first 100 fields of the root entity SELECT * FROM Account;
-
Nested Queries
-
INSERT and UPDATE Statements Supported functions for value calculation:
NOW()GETDATE()
Example:
INSERT INTO Account(Name, Phone) VALUES ('Account01', '555-123-1111'), ('Account02', '555-123-2222'); INSERT INTO Contact(FirstName, LastName, AccountId) SELECT Name, Phone, Id FROM Account WHERE Name LIKE 'Account0%'; UPDATE Contact SET LastName = 'Updated_Now_' + NOW() WHERE AccountId IN ( SELECT Id FROM Account WHERE Phone = '555-123-1111' AND CreatedDate > '{ts 2020-01-01 00:10:12Z}' );
-
DELETE Statements
DELETE FROM Opportunity WHERE Name LIKE 'Pushed Out Insightor Opp%';
-
Request Caching Supports local caching in two modes:
- Global: Cached results are accessible to all system users within the JVM session.
- Session: Caching is isolated to each Salesforce connection session.
Cache duration is limited to the JVM lifespan or a maximum of 1 hour. Enable caching using a query prefix:
- Global cache mode:
CACHE GLOBAL SELECT Id, Name FROM Account
- Session cache mode:
CACHE SESSION SELECT Id, Name FROM Account
Add the following dependency to your pom.xml:
<dependency>
<groupId>it.rotaliano.salesforce</groupId>
<artifactId>salesforce-jdbc</artifactId>
<version>2.0.0</version>
</dependency>it.rotaliano.jdbc.salesforce.ForceDriver
jdbc:rotaliano:salesforce://[;propertyName1=propertyValue1[;propertyName2=propertyValue2]...]
You can connect using either User/Password or Session ID.
1. User and Password
jdbc:rotaliano:salesforce://;user=myname@companyorg.com;password=passwordandsecretkey
Note: The password must be a concatenation of your Salesforce password and security token.
2. Session ID
jdbc:rotaliano:salesforce://;sessionId=uniqueIdAssociatedWithTheSession
Note: User and password parameters are ignored if sessionId is provided.
| Property | Description | Default Value |
|---|---|---|
user |
Login username. | |
password |
Login password concatenated with the security token. | |
sessionId |
Unique ID associated with an active session. | |
loginDomain |
Top-level domain for login requests. Set to test.salesforce.com for sandbox environments. |
login.salesforce.com |
https |
Use HTTP instead of HTTPS if set to false. |
true |
api |
API version to use. | 64 |
client |
Client ID to use. | Empty |
insecurehttps |
Allow invalid SSL certificates. | false |
-
Follow the guide on How to add a JDBC driver.
-
Set configuration properties using property binding in the data source editor.
Refer to the [Salesforce JDBC report sample](docs/birt/Salesforce JDBC sample.rptdesign) for a complete example.
-
Follow the guide on How to add a JDBC driver.
-
Configure the JDBC URL with the necessary properties.
Example URL:
jdbc:rotaliano:salesforce://dev@Local.org:123456@localorg.localhost.internal.salesforce.com:6109?https=false&api=61.0Ensure you verify your access type (HTTP/HTTPS) and API version.
To update partners.wsdl:
- Clone and build force-wsc.
- Run the following command:
java -jar target/force-wsc-50.0.0-uber.jar blt/app/main/core/shared/submodules/wsdl/src/main/wsdl/partner.wsdl sforce-partner.jar
- Copy
com.sforce.soapto the driver source.
See CHANGELOG.md.
We welcome contributions! Please review the following guides:
Also, consider sponsoring this project! ✌️
This project is licensed under the MIT License - see the LICENSE file for details.



