简体   繁体   English

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

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

I'm trying to use Spring JDBC Template to call a stored procedure inside a postgres database.我正在尝试使用 Spring JDBC Template 在 postgres 数据库中调用存储过程。 The connection is done from the yaml configuration file to indicate the current schema to use:连接是从 yaml 配置文件完成的,以指示要使用的当前架构:

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

Every queries done directly from jdbc template is using the correct current schema "customschema".直接从 jdbc 模板完成的每个查询都使用正确的当前模式“customschema”。 However, only executions done from SimpleJdbcCall to call a stored procedure is done in postgres default schema which is "public", and I can't understand why.但是,只有从 SimpleJdbcCall 调用存储过程的执行是在“公共”的 postgres 默认模式中完成的,我不明白为什么。

Here is the execution code:这是执行代码:

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

While debugging, if I look at that jdbcTemplate.getDataSource().getConnection().getSchema() , it returns the correct schema which is "customschema".在调试时,如果我查看jdbcTemplate.getDataSource().getConnection().getSchema() ,它会返回正确的模式,即“customschema”。

I need to force the schema with .withSchemaName("customschema") for this execution to work with the correct schema instead of "public".我需要使用.withSchemaName("customschema")强制架构,以便此执行使用正确的架构而不是“公共”。

I can't find any documentation online regarding this behavior.我在网上找不到有关此行为的任何文档。

Is it an issue from the library itself ?这是图书馆本身的问题吗?

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

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

相关问题 使用带有回调的Spring SimpleJdbcCall调用存储过程 - Call stored procedure using Spring SimpleJdbcCall with callback 使用SimpleJdbcCall和REF_CURSOR调用PostgreSQL存储过程 - Call PostgreSQL stored procedure using SimpleJdbcCall and REF_CURSOR 如何使用 SimpleJdbcCall 同步调用存储过程 - How to call a stored procedure synchronously with SimpleJdbcCall SimpleJdbcCall:获取Microsoft / Sybase存储过程调用的结果 - SimpleJdbcCall: get result of Microsoft/Sybase stored procedure call Spring-使用存储过程时使用simplejdbccall进行批处理更新 - Spring - Batch update using simplejdbccall while using Stored Procedure 如何在spring中使用SimpleJDBCCall获取存储过程的多表结果? - How to get multi table results of an stored procedure using SimpleJDBCCall in spring? SimpleJdbcCall:读取从存储过程返回的CLOB - SimpleJdbcCall: Reading a CLOB returned from stored procedure SimpleJdbcCall 不能调用多个过程 - SimpleJdbcCall can not call more than one procedure 如何在带有两个结果表的spring中使用SimpleJDBCCall获得存储过程的结果? - How to get results of an stored procedure using SimpleJDBCCall in spring with two result table? 使用 java SimpleJdbcCall 调用过程 oracle 没有参数类型“is table of varchar2” - Call procedure oracle with out parameters type “is table of varchar2” using java SimpleJdbcCall
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM