繁体   English   中英

使用 SimpleJdbcCall 调用不使用当前模式的存储过程

[英]Use of SimpleJdbcCall to call stored procedure not using the current schema

我正在尝试使用 Spring JDBC Template 在 postgres 数据库中调用存储过程。 连接是从 yaml 配置文件完成的,以指示要使用的当前架构:

jdbc:postgresql://localhost:5455/userdb?currentSchema=customschema

直接从 jdbc 模板完成的每个查询都使用正确的当前模式“customschema”。 但是,只有从 SimpleJdbcCall 调用存储过程的执行是在“公共”的 postgres 默认模式中完成的,我不明白为什么。

这是执行代码:

new SimpleJdbcCall(jdbcTemplate).withFunctionName("custom_stored_procedure_name").execute();

在调试时,如果我查看jdbcTemplate.getDataSource().getConnection().getSchema() ,它会返回正确的模式,即“customschema”。

我需要使用.withSchemaName("customschema")强制架构,以便此执行使用正确的架构而不是“公共”。

我在网上找不到有关此行为的任何文档。

这是图书馆本身的问题吗?

为每个调用指定架构或将架构添加到搜索路径

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM