Integration Your Way - (800) 235-7250
RSSBus JDBC Driver for Salesforce V3
Questions / Feedback? Querying the Data

Querying the Data

The RSSBus JDBC Driver for Salesforce V3 follows the JDBC convention: first load the Salesforce driver class, then make a connection, and finally execute the query to retrieve the data from the ResultSet.

Load the Driver

Note: This step is optional per the JDBC 4.0 specification.
Class.forName("rssbus.jdbc.salesforce.SalesforceDriver");

Establish a Connection

To establish a connection you must prepare a connection string. The connection string must start with "jdbc:salesforce:", and may include any connection property. A typical connection string looks like "jdbc:salesforce:User=myUser;Password=myPassword;Access Token=myToken;". The connection string can be used with the DriverManager.getConnection() method to obtain a connection object.

Connection conn = DriverManager.getConnection("jdbc:salesforce:User=myUser;Password=myPassword;Access Token=myToken;");
Alternatively, you may prepare the connection options using the Properties object and use it with the DriverManager.
Properties prop = new Properties();
prop.put("User","XXX");
prop.put("Password","YYY");
prop.put("Location","ZZZ");
Connection conn = DriverManager.getConnection("jdbc:salesforce:",prop);

Create a Statement


Statement stat = conn.createStatement();

Execute the Query

The example below selects the Id and Name columns of the Account table.

boolean ret = stat.execute("SELECT Id, Name FROM Account");
ResultSet rs=stat.getResultSet();
while(rs.next()){
  for(int i=1;i<=rs.getMetaData().getColumnCount();i++)
  {
    System.out.println(rs.getMetaData().getColumnName(i) +"="+rs.getString(i));
  }
}
We can also use the Statement object to execute an INSERT, UPDATE or DELETE statement. The example below updates the Id and Name columns of the Account table.
stat.execute("UPDATE Account SET Id = 'XXX' , Name = 'YYY'");
int count=stat.getUpdateCount();
System.out.println(count+" rows are affected");

Supported SQL Syntax

The RSSBus JDBC Driver for Salesforce V3 supports a restricted subset of the SQL Syntax. See SELECT Statements for details.


 
Copyright © 2013 RSSBus Inc.
[x] close

Questions / Feedback?


Name:
Email:
Feedback:
Send Feedback