2011-11-05 123 views
0

任何人都可以幫助我將參數傳遞給birt數據集中的存儲過程嗎?當我嘗試運行報告,我總是得到這樣的例外:Birt PostgreSQL - 存儲過程數據集

 
org.eclipse.birt.report.data.oda.jdbc.JDBCException: Cannot set preparedStatement parameter string value. 
SQL error #1: Index of column is out of bounds: 1, column count: 0. 
; 
    org.postgresql.util.PSQLException: Index of column is out of bounds: 1, column count: 0. 
    at org.eclipse.birt.report.data.oda.jdbc.Statement.setString(Statement.java:656) 
    at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaQuery.setString(OdaQuery.java:733) 
    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.doSetString(PreparedStatement.java:4422) 
    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.setString(PreparedStatement.java:4031) 
    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.setParameterValue(PreparedStatement.java:3235) 
    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.setParameterValue(PreparedStatement.java:3171) 
    at org.eclipse.birt.data.engine.executor.DataSourceQuery.setInputParameterBinding(DataSourceQuery.java:947) 
    at org.eclipse.birt.data.engine.executor.DataSourceQuery.addParameterDefns(DataSourceQuery.java:530) 
    at org.eclipse.birt.data.engine.executor.DataSourceQuery.prepare(DataSourceQuery.java:283) 
    at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery$OdaDSQueryExecutor.prepareOdiQuery(PreparedOdaDSQuery.java:413) 
    at org.eclipse.birt.data.engine.impl.QueryExecutor.prepareExecution(QueryExecutor.java:339) 
    at org.eclipse.birt.data.engine.impl.PreparedQuery.doPrepare(PreparedQuery.java:448) 
    at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.produceQueryResults(PreparedDataSourceQuery.java:190) 
    at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.execute(PreparedDataSourceQuery.java:178) 
    at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery.execute(PreparedOdaDSQuery.java:145) 
    at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.execute(DataRequestSessionImpl.java:560) 
    at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:152) 
    at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:265) 
    at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1875) 
    at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:80) 
    at org.eclipse.birt.report.engine.executor.TableItemExecutor.execute(TableItemExecutor.java:62) 
    at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43) 
    at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46) 
    at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34) 
    at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65) 
    at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:90) 
    at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:99) 
    at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:170) 
    at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:75) 
    at cz.dantem.fast.vm.birt.reports.ExecuteReport$1.run(ExecuteReport.java:185) 
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) 
Caused by: org.postgresql.util.PSQLException: Index sloupece je mimo rozsah: 1, počet sloupců: 0. 
    at org.postgresql.core.v3.SimpleParameterList.bind(SimpleParameterList.java:53) 
    at org.postgresql.core.v3.SimpleParameterList.setStringParameter(SimpleParameterList.java:118) 
    at org.postgresql.jdbc2.AbstractJdbc2Statement.bindString(AbstractJdbc2Statement.java:2184) 
    at org.postgresql.jdbc2.AbstractJdbc2Statement.setString(AbstractJdbc2Statement.java:1303) 
    at org.postgresql.jdbc2.AbstractJdbc2Statement.setString(AbstractJdbc2Statement.java:1289) 
    at org.eclipse.birt.report.data.oda.jdbc.Statement.setString(Statement.java:651) 
    ... 30 more 
5.11.2011 17:03:47 org.eclipse.birt.data.engine.odaconsumer.PreparedStatement retrySetParameterValue 
SEVERE: Cannot set input parameter. 
org.eclipse.birt.data.engine.core.DataException: Cannot set the string value (LP) to parameter 1. 
Cannot set preparedStatement parameter string value. 
SQL error #1: Index of column is out of bounds: 1, column count: 0. 

    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.handleException(PreparedStatement.java:4835) 
    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.doSetString(PreparedStatement.java:4427) 
    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.setString(PreparedStatement.java:4031) 
    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.setParameterValue(PreparedStatement.java:3235) 
    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.setParameterValue(PreparedStatement.java:3171) 
    at org.eclipse.birt.data.engine.executor.DataSourceQuery.setInputParameterBinding(DataSourceQuery.java:947) 
    at org.eclipse.birt.data.engine.executor.DataSourceQuery.addParameterDefns(DataSourceQuery.java:530) 
    at org.eclipse.birt.data.engine.executor.DataSourceQuery.prepare(DataSourceQuery.java:283) 
    at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery$OdaDSQueryExecutor.prepareOdiQuery(PreparedOdaDSQuery.java:413) 
    at org.eclipse.birt.data.engine.impl.QueryExecutor.prepareExecution(QueryExecutor.java:339) 
    at org.eclipse.birt.data.engine.impl.PreparedQuery.doPrepare(PreparedQuery.java:448) 
    at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.produceQueryResults(PreparedDataSourceQuery.java:190) 
    at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.execute(PreparedDataSourceQuery.java:178) 
    at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery.execute(PreparedOdaDSQuery.java:145) 
    at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.execute(DataRequestSessionImpl.java:560) 
    at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:152) 
    at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:265) 
    at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1875) 
    at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:80) 
    at org.eclipse.birt.report.engine.executor.TableItemExecutor.execute(TableItemExecutor.java:62) 
    at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43) 
    at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46) 
    at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34) 
    at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65) 
    at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:90) 
    at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:99) 
    at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:170) 
    at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:75) 
    at cz.dantem.fast.vm.birt.reports.ExecuteReport$1.run(ExecuteReport.java:185) 
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) 
Caused by: org.eclipse.birt.report.data.oda.jdbc.JDBCException: Cannot set preparedStatement parameter string value. 
SQL error #1: Index sloupece je mimo rozsah: 1, počet sloupců: 0. 
; 
    org.postgresql.util.PSQLException: Index sloupece je mimo rozsah: 1, počet sloupců: 0. 
    at org.eclipse.birt.report.data.oda.jdbc.Statement.setString(Statement.java:656) 
    at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaQuery.setString(OdaQuery.java:733) 
    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.doSetString(PreparedStatement.java:4422) 
    ... 28 more 
Caused by: org.postgresql.util.PSQLException: Index sloupece je mimo rozsah: 1, počet sloupců: 0. 
    at org.postgresql.core.v3.SimpleParameterList.bind(SimpleParameterList.java:53) 
    at org.postgresql.core.v3.SimpleParameterList.setStringParameter(SimpleParameterList.java:118) 
    at org.postgresql.jdbc2.AbstractJdbc2Statement.bindString(AbstractJdbc2Statement.java:2184) 
    at org.postgresql.jdbc2.AbstractJdbc2Statement.setString(AbstractJdbc2Statement.java:1303) 
    at org.postgresql.jdbc2.AbstractJdbc2Statement.setString(AbstractJdbc2Statement.java:1289) 
    at org.eclipse.birt.report.data.oda.jdbc.Statement.setString(Statement.java:651) 
    ... 30 more 
5.11.2011 17:03:47 org.eclipse.birt.report.engine.emitter.excel.ExcelEmitter needOutputInMasterPage 
+0

我用select * from procedureName('?')調用我的函數。過程返回數據表並具有一個輸入參數 - 文本 –

+0

存儲過程的參數類型是什麼? – aleroot

+0

參數類型是文本 –

回答

1

可能是與BIRT參數期望的類型和你傳遞型(String)類型不匹配。

如果您在存儲過程中使用了文本作爲參數類型,那麼通常Java/JDBC中的相應類型爲java.sql.Types.CLOB。

+0

我嘗試將參數類型更改爲varchar(50),但錯誤是相同的 –