Skip to content

ascendix/salesforce-jdbc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sforce-jdbc Build Status Build Status

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.

Supported Salesforce and Java versions

The current version of the driver should be compatible with Salesforce Partner API version 39.0 and higher and Java 8.

Get the driver

Download the driver here

With Maven

Add repositories

<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>

Add dependency

<dependency>
    <groupId>com.ascendix.salesforce</groupId>
    <artifactId>salesforce-jdbc</artifactId>
    <version>1.1-20180403.104727-1</version>
 </dependency>

How to connect

Driver class name

com.ascendix.jdbc.salesforce.ForceDriver

JDBC URL format

jdbc:ascendix:salesforce://[;propertyName1=propertyValue1[;propertyName2=propertyValue2]...]

There are two ways to connect to Salesforce:

  1. by using user and password;
  2. 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://;[email protected];password=passwordandsecretkey

An example for a connection URL with sessionId parameter:

jdbc:ascendix:salesforce://;sessionId=uniqueIdAssociatedWithTheSession

Configuration Properties

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.

Supported features

  1. Queries support native SOQL;
  2. Nested queries are supported;
  3. 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

Limitations

  1. The driver is only for read-only purposes now. Insert/udate/delete functionality is not implemented yet.

Configure BIRT Studio to use Salesforce JDBC driver

  1. How to add a JDBC driver

  2. 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.

    image

    See how it's done in [Salesforce JDBC report sample](docs/birt/Salesforce JDBC sample.rptdesign)

Sponsors

Ascendix Technologies Inc.