gpt4 book ai didi

java - Hana参数化存储过程问题简单jdbc模板

转载 作者:行者123 更新时间:2023-11-30 06:58:49 25 4
gpt4 key购买 nike

看起来 jdbc 模板在调用存储过程时没有将参数传递给 hana db。根据我们的分析,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.

我想说你需要使用SimpleJdbcCall#declareParameters(SqlParameter...)

关于java - Hana参数化存储过程问题简单jdbc模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41319097/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com