java 调用 dfx 文件传参报错
能正确执行
我用 java 调用这个 dfx 文件
package com.doeis.inventory.action;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import com.doeis.Action;
/**
* 类描述: 润乾报表报表统计结果
*
* @author conca
* @date 2018 年 11 月 13 日 上午 9:57:47
*/
public class RaqsoftReportStatisticsAction extends Action {
public static void main(String[] args) {
RaqsoftReportStatisticsAction action = new RaqsoftReportStatisticsAction();
try {
action.testUsers();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void testUsers() throws ClassNotFoundException, SQLException{
Connection con = null;
com.esproc.jdbc.InternalCStatement st;
// 建立连接
Class.forName("com.esproc.jdbc.InternalDriver");
con= DriverManager.getConnection("jdbc:esproc:local://");
// 调用存储过程,其中 users 是 dfx 的文件名
st =(com. esproc.jdbc.InternalCStatement)con.prepareCall("call erport-1-1-1(?)");
st.setString(1, "8a9e23296e17be4e016e1a647d437dd0");
st.setString(2, "ff808081781b586501781ff72f8e4277.find({status:true})");
st.setString(3, "2c960b3a7868ed6201786d21cc2b07f6;sum(2c960b3a786d40cc01786d792f963d36):SUM");
// 执行存储过程
st.execute();
// 获取结果集
ResultSet rs = st.getResultSet();
ResultSetMetaData rsmd = rs.getMetaData();
int colCount = rsmd.getColumnCount();
for (int c = 1; c <= colCount; c++) {
String title = rsmd.getColumnName(c);
if (c > 1) {
System.out.print("\t");
}
else {
System.out.print("\n");
}
System.out.print(title);
}
while (rs.next()) {
for (int c = 1; c <= colCount; c++) {
if (c > 1) {
System.out.print("\t");
}
else {
System.out.print("\n");
}
Object o = rs.getObject(c);
System.out.print(o!=null?o.toString():"");
}
}
}
}
代码执行结果报错:
[2021-04-30 17:13:45]
INFO: jdbc config from : file:/C:/me/workhome/jee-2020-03/workspace/doeisweb/build/classes/raqsoftConfig.xml
Log level:DEBUG
[2021-04-30 17:13:45]
DEBUG: Dfx path: demo
[2021-04-30 17:13:45]
INFO: load library [mongo] from MongoCli
[2021-04-30 17:13:45]
INFO: Config file: raqsoftConfig.xml has been loaded.
[2021-04-30 17:13:45]
DEBUG: parallelNum=1
[2021-04-30 17:13:48]
INFO: SQL:[call erport-1-1-1(?)]
[2021-04-30 17:13:48]
INFO: param size=3
[2021-04-30 17:13:48]
DEBUG: param1=[8a9e23296e17be4e016e1a647d437dd0]
[2021-04-30 17:13:48]
DEBUG: param2=[ff808081781b586501781ff72f8e4277.find({status:true})]
[2021-04-30 17:13:48]
DEBUG: param3=[2c960b3a7868ed6201786d21cc2b07f6;sum(2c960b3a786d40cc01786d792f963d36):SUM]
[2021-04-30 17:13:48]
INFO: SQL:[call erport-1-1-1(?)]
[2021-04-30 17:13:48]
INFO: param size=3
[2021-04-30 17:13:48]
DEBUG: param1=[8a9e23296e17be4e016e1a647d437dd0]
[2021-04-30 17:13:48]
DEBUG: param2=[ff808081781b586501781ff72f8e4277.find({status:true})]
[2021-04-30 17:13:48]
DEBUG: param3=[2c960b3a7868ed6201786d21cc2b07f6;sum(2c960b3a786d40cc01786d792f963d36):SUM]
java.sql.SQLException: 单元格 A2 中有错误
不能识别的表达式:hnctable
at com.esproc.jdbc.InternalStatement.executeJDBC(Unknown Source:205)
at com.esproc.jdbc.IllIlIlIlIIIllII.run(Unknown Source:65)
Caused by: com.raqsoft.common.RQException: 单元格 A2 中有错误
不能识别的表达式:hnctable
at com.raqsoft.expression.UnknownSymbol.calculate(Unknown Source:175)
at com.raqsoft.expression.Expression.calculate(Unknown Source:107)
at com.raqsoft.lib.mongo.function.ImShell.calculate(ImShell.java:52)
at com.raqsoft.expression.operator.DotOperator.getLeftObject(Unknown Source:21)
at com.raqsoft.expression.operator.DotOperator.calculate(Unknown Source:40)
at com.raqsoft.expression.Expression.calculate(Unknown Source:107)
at com.raqsoft.cellset.datamodel.PgmNormalCell.calculate(Unknown Source:153)
at com.raqsoft.cellset.datamodel.PgmCellSet._$3(Unknown Source:1993)
at com.raqsoft.cellset.datamodel.PgmCellSet.execute(Unknown Source:2552)
at com.raqsoft.cellset.datamodel.PgmCellSet.calculateResult(Unknown Source:2595)
at com.raqsoft.expression.function.JDBCCall.calculate(Unknown Source:94)
at com.raqsoft.expression.Expression.calculate(Unknown Source:107)
at com.raqsoft.expression.function.Evaluator.calc(Unknown Source:78)
at com.esproc.jdbc.JDBCUtil.execute(Unknown Source:319)
at com.esproc.jdbc.InternalStatement.executeJDBC(Unknown Source:188)
… 1 more
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
调用时一个参数一个问号,所以这里应该是 3 个 “call erport-1-1-1(?,?,?)”