How to call stored procedure that returns sys_refcursor from ireport 4.5.1

二次信任 提交于 2019-12-13 18:03:26

问题


can anyone provide complete tutorial on how to call stored procedure that returns sys_refcursor from ireport 4.5.1. i have already followed this link http://rajendratambat.blogspot.in/2011/10/calling-oracle-stored-procedure-in.html?showComment=1333264003761#c6148133813463786818

but it doesn't work for me.so can anyone have another solution.


回答1:


Below are the steps to call a stored procedure to build a report using iReport 4.5/4.5.1 JasperReport

  1. In your iReport designer go to Tools --> Options --> and in the Classpath Tab click Add JAR and add the OJDBC14.jar to the classpath.
  2. Go to Query Executer tab and set the following Language: plsql Query Executer Factory: com.jaspersoft.jrx.query.PlSqlQueryExecuterFactory Fields Provider Class: com.jaspersoft.ireport.designer.data.fieldsproviders.SQLFieldsProvider
  3. Select Database JDBC Connection
  4. Select Oracle as the JDBC Driver as shown in the image below and verify the connection by clicking the Test button (Make sure you check the Save Password check box)
  5. Create a blank report by giving a report name and save it.
  6. Open the report in the designer and right click on the report name and click on Edit Query
  7. Set the query language to plsql
  8. Call your procedure with in { } a. {call PUBLISHER_AND_BOOKS(&P(P_PUBLISHER_ID), &P(ORACLE_REF_CURSOR))} Note: P_PUBLISHER_ID is of type string and ORACLE_REF_CURSOR is of type java.sql.ResultSet data type custom parameter. You can create this by clicking the New Parameter button. If you have more input parameters use ‘,’ as your delimiter as shown in the above example.
  9. Click Ok and proceed with the report design.
  10. In the designer window right click on Fields and add click Add Fields and make sure all the field name matches the column name in your stored procedure
  11. Now right click on the parameters and add the parameters matching the stored procedure NOTE: make sure you uncheck the "Use for Prompt" in the property for your out parameter in our example its ORACLE_REF_CURSOR is the out parameter.
  12. Drag and drop the fields in the report detail band as shown below
  13. Click preview to run the report you will be prompted with the input parameter

All the steps are captured in detail with images and available in the below link hope this helps...

http://meezageekyside.blogspot.com/#!/2012/04/jasper-reports-ireport-45-using-oracle.html



来源:https://stackoverflow.com/questions/9962622/how-to-call-stored-procedure-that-returns-sys-refcursor-from-ireport-4-5-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!