Hana 参数化存储过程问题简单 jdbc 模板
Hana Parameterised stored proc issue simple jdbc template
看起来 jdbc 模板在调用存储过程时没有将参数传递给 hana 数据库。
根据我们的分析 spring jdbc 实现并未从元数据中识别过程参数。
.我们正在使用调用proc的标准代码。
simpleJdbcCall = new SimpleJdbcCall(datasource).withSchemaName(getSchemaString())
.withProcedureName(name);
results = simpleJdbcCall.execute(params);
我们尝试在网上搜索但没有找到令人满意的解决方案
我也试过设置参数显式
simpleJdbcCall = new SimpleJdbcCall(datasource).withSchemaName(getSchemaString())
.withProcedureName(name);
SqlParameterSource in = new MapSqlParameterSource().addValues(params);
results = simpleJdbcCall.execute(in);
这里的params是hashmap。
问题还是一样
来自javadoc(重点是我的):
The meta data processing is based on the DatabaseMetaData provided by the JDBC driver. Since we rely on the JDBC driver, this "auto-detection" can only be used for databases that are known to provide accurate meta data. These currently include Derby, MySQL, Microsoft SQL Server, Oracle, DB2, Sybase and PostgreSQL. For any other databases you are required to declare all parameters explicitly.
看起来 jdbc 模板在调用存储过程时没有将参数传递给 hana 数据库。 根据我们的分析 spring jdbc 实现并未从元数据中识别过程参数。 .我们正在使用调用proc的标准代码。
simpleJdbcCall = new SimpleJdbcCall(datasource).withSchemaName(getSchemaString())
.withProcedureName(name);
results = simpleJdbcCall.execute(params);
我们尝试在网上搜索但没有找到令人满意的解决方案 我也试过设置参数显式
simpleJdbcCall = new SimpleJdbcCall(datasource).withSchemaName(getSchemaString())
.withProcedureName(name);
SqlParameterSource in = new MapSqlParameterSource().addValues(params);
results = simpleJdbcCall.execute(in);
这里的params是hashmap。 问题还是一样
来自javadoc(重点是我的):
The meta data processing is based on the DatabaseMetaData provided by the JDBC driver. Since we rely on the JDBC driver, this "auto-detection" can only be used for databases that are known to provide accurate meta data. These currently include Derby, MySQL, Microsoft SQL Server, Oracle, DB2, Sybase and PostgreSQL. For any other databases you are required to declare all parameters explicitly.