Reports
- Last Updated: May 15, 2020
- 1 minute read
- DataDirect Connectors
- JDBC
- IBM Db2 5.1
- MySQL 5.1
- Progress OpenEdge 5.1
- SAP Sybase 5.1
- Documentation
The Salesforce driver exposes reports defined on a Salesforce instance as stored procedures. An application can obtain a list of the reports defined on a Salesforce instance by calling the DatabaseMetaData.getProcedures method. The names of the reports that can be invoked through the driver are listed in the PROCEDURE_NAME name column of the getProcedures() results.
Salesforce organizes reports into folders. The Salesforce driver incorporates the folder name and report name into the procedure name reported by getProcedures(). The driver creates the reported procedure name by prepending the folder name to the report name using an underscore (_) to join them. Additionally, any spaces in the report or folder names are replaced with an underscore character. Like all identifier name metadata returned by the driver, the procedure name is uppercase. For example, if a report named Opportunity Pipeline is in the folder Opportunity Reports, it would be:
OPPORTUNITY_REPORTS_OPPORTUNITY_PIPELINE
An application invokes a report using the standard Call escape syntax, {call
report name}, and JDBC mechanisms for calling a stored procedure
that returns a result set. The following example shows one way to invoke the Opportunity
Pipeline report:
String sql = "{call OPPORTUNITY_REPORTS_OPPORTUNITY_PIPELINE()}";
CallableStatement callStmt = con.prepareCall(sql);
boolean isResultSet = callStmt.execute();
if (isResultSet) {
resultSet = callStmt.getResultSet();
// process the resultset
}