SAP Knowledge Base Article - Public

1580281 - Crystal Reports JDBC connection Error: Failed to retrieve data from the database. Details: Exception: [Error Message:]String index out of range: -1

Symptom

 

  • Crystal Report connecting through JDBC to a SQL Server stored procedure
  • SQL Server Stored Procedure uses SQL / DML statement(s) CREATE, UPDATE or DELETE
  • Stored Procedure runs fine in SQL Server Query Analyzer

       error message

Cause

  • Crystal Reports requires that the response from the database be in a table (single) dataset format (row/column).
  • SQL Server will, by default, send a message back to the client when a process such as an update completes successfully.

      sql server behavior

  • These messages are the cause of the error in Crystal Reports.

Resolution

Add the following line to your stored procedure...which will suppress the messages being sent back to the client.

SET NOCOUNT ON

Keywords

odbc, native, stored proc, CR, jtds, sqljdbc.jar , KBA , BI-RA-CR , Crystal Reports designer or BusinessViews Manager , Problem

Product

SAP Crystal Reports XI R2