如何调用从ireport 4.5.1返回sys_refcursor的存储过程 [英] How to call stored procedure that returns sys_refcursor from ireport 4.5.1

查看:204
本文介绍了如何调用从ireport 4.5.1返回sys_refcursor的存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以提供有关如何调用从ireport 4.5.1返回sys_refcursor的存储过程的完整教程。
i已经关注此链接
http://rajendratambat.blogspot.in/2011/10/calling-oracle-stored-procedure-in.html?showComment=1333264003761#c6148133813463786818

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.

推荐答案

以下是使用iReport 4.5 / 4.5.1调用存储过程来构建报表的步骤JasperReport

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


  1. 在iReport设计器中转到工具 - >选项 - >并在Classpath选项卡中单击Add JAR并将OJDBC14.jar添加到类路径。

  2. 转到Query Executer选项卡并设置以下
    语言:plsql
    Query Executer Factory:com.jaspersoft.jrx.query.PlSqlQueryExecuterFactory
    Fields Provider Class:com.jaspersoft.ireport.designer.data.fieldsproviders.SQLFieldsProvider

  3. 选择数据库JDBC连接

  4. 选择Oracle作为JDBC驱动程序,如下图所示,单击Test按钮验证连接(确保选中Save密码复选框)

  5. 通过提供报告名称创建空白报告并保存。

  6. 在设计器中打开报告并右键单击报告名称并单击编辑查询

  7. 将查询语言设置为plsql

  8. 使用{}
    a调用您的过程。 {call PUBLISHER_AND_BOOKS(& P(P_PUBLISHER_ID),& P(ORACLE_REF_CURSOR))}
    注意:P_PUBLISHER_ID的类型为string,ORACLE_REF_CURSOR的类型为java.sql.ResultSet数据类型自定义参数。您可以通过单击新建参数按钮来创建它。如果您有更多输入参数,请使用','作为分隔符,如上例所示。

  9. 单击确定继续进行报告设计。

  10. 在设计器窗口中右键单击字段并添加单击添加字段并确保所有字段名称与存储过程中的列名称匹配

  11. 现在右键单击参数并添加参数匹配存储过程注意:请确保在我们的示例中取消选中out参数的属性中的Use for Prompt,其ORACLE_REF_CURSOR是out参数。

  12. 拖放字段报告详细信息区域如下所示

  13. 点击预览以运行报告,您将通过输入参数提示

  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

这篇关于如何调用从ireport 4.5.1返回sys_refcursor的存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆