The 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
}
Note: The API used by the driver to obtain the list of reports and execute the reports is not an API that is documented by Salesforce. This API may change or may not be supported in the future.
Note: When passing parameters to stored procedures, reports are not supported.