Jump to content
Changes to the Jaspersoft community edition download ×
  • Getting "Statement did not return a result set" Error When Using Stored Procedure To Access MSSQL Data From Studio


    tchen
    • Features: Data Sources Version: v6.2, v6.2.1, v6.1.1 Product: JasperReports® Library

    Problem:

    When using a stored procedure to get data from MSSQL data source in Jasper Studio, user got the following error:

    "Statement did not return a result set"

    Cause:

    MSSQL returns the count of the number of rows affected by a Transact-SQL statement or stored procedure as part of the result set. JDBC driver used in the Studio to get to the data source can  become confused as to what it should put into the ResultSet therefore throwing out the error.

    Resolution:

    User's stored procedure needs to include SET NOCOUNT ON right at the beginning of the procedure declaration to suppress the "n rows affected" counts to avoid the confusion to the driver. For example:

    CREATE PROCEDURE p2
    AS
    
    SET NOCOUNT ON
    
    declare @t1 table(
        ref varchar(20)
    )
    ...........


    Reference:

    SET NOCOUNT (Transact-SQL)

    =================================================
    TTC-20160425-67826


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...