• <i id='cT5e1'><tr id='cT5e1'><dt id='cT5e1'><q id='cT5e1'><span id='cT5e1'><b id='cT5e1'><form id='cT5e1'><ins id='cT5e1'></ins><ul id='cT5e1'></ul><sub id='cT5e1'></sub></form><legend id='cT5e1'></legend><bdo id='cT5e1'><pre id='cT5e1'><center id='cT5e1'></center></pre></bdo></b><th id='cT5e1'></th></span></q></dt></tr></i><div id='cT5e1'><tfoot id='cT5e1'></tfoot><dl id='cT5e1'><fieldset id='cT5e1'></fieldset></dl></div>

    1. <tfoot id='cT5e1'></tfoot>

      <small id='cT5e1'></small><noframes id='cT5e1'>

      <legend id='cT5e1'><style id='cT5e1'><dir id='cT5e1'><q id='cT5e1'></q></dir></style></legend>
      • <bdo id='cT5e1'></bdo><ul id='cT5e1'></ul>

      1. Weblogic:调用没有模式名称的 DB2 存储过程(属性

        时间:2023-09-30
        <i id='CZ2Fj'><tr id='CZ2Fj'><dt id='CZ2Fj'><q id='CZ2Fj'><span id='CZ2Fj'><b id='CZ2Fj'><form id='CZ2Fj'><ins id='CZ2Fj'></ins><ul id='CZ2Fj'></ul><sub id='CZ2Fj'></sub></form><legend id='CZ2Fj'></legend><bdo id='CZ2Fj'><pre id='CZ2Fj'><center id='CZ2Fj'></center></pre></bdo></b><th id='CZ2Fj'></th></span></q></dt></tr></i><div id='CZ2Fj'><tfoot id='CZ2Fj'></tfoot><dl id='CZ2Fj'><fieldset id='CZ2Fj'></fieldset></dl></div>

        <small id='CZ2Fj'></small><noframes id='CZ2Fj'>

          <tbody id='CZ2Fj'></tbody>

            <tfoot id='CZ2Fj'></tfoot>
              <bdo id='CZ2Fj'></bdo><ul id='CZ2Fj'></ul>
              <legend id='CZ2Fj'><style id='CZ2Fj'><dir id='CZ2Fj'><q id='CZ2Fj'></q></dir></style></legend>

                1. 本文介绍了Weblogic:调用没有模式名称的 DB2 存储过程(属性 currentSchema)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个在 Weblogic 上运行的 Java 应用程序.应用程序需要访问 DB2 数据库中的存储过程,因此通过其 JNDI 名称配置和访问 JDBC 数据源.

                  I have a Java application that runs on Weblogic. The application needs to access a stored procedure in a DB2 data base, therefore a JDBC data source is configured and accessed by its JNDI name.

                  数据来源:

                  ClassDriver: com.ibm.db2.jcc.DB2Driver
                  
                  Properties:
                  user=MYUSER
                  DatabaseName=MYDB
                  

                  以下示例按预期工作.

                  Context env = null;
                  DataSource pool = null;
                  
                  Hashtable ht = new Hashtable();
                  ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
                  ht.put(Context.PROVIDER_URL,"t3://myserver:7777");
                  
                  env = new InitialContext(ht);
                  
                  pool = (DataSource) env.lookup("jdbc/myjndiname");
                  conn = pool.getConnection();
                  
                  // call stored procedure with schema name
                  String procName = "MYSCHEMA.MYSTOREDPROCEDURE";
                  String sql = "CALL " + procName + "(?)";
                  callStmt = conn.prepareCall(sql);
                  
                  callStmt.setString(1, "1");
                  callStmt.execute();
                  

                  但现在我需要调用不带架构名称的存储过程,并改用 JDBC 驱动程序属性.

                  But now I need to call the stored procedure without the schema name and use a JDBC driver property instead.

                  数据来源:

                  ClassDriver: com.ibm.db2.jcc.DB2Driver
                  
                  Properties:
                  user=MYUSER
                  DatabaseName=MYDB
                  db2.jcc.override.currentSchema=MYSCHEMA
                  com.ibm.db2.jcc.DB2BaseDataSource.currentSchema=MYSCHEMA 
                  

                  以下 SQL 调用导致错误

                  The following SQL call results in an error

                  // call stored procedure without schema name
                  String procName = "MYSTOREDPROCEDURE";
                  String sql = "CALL " + procName + "(?)";
                  callStmt = conn.prepareCall(sql);
                  

                  SQL 错误:

                  SQLCODE = -440, ERROR:  NO PROCEDURE BY THE NAME MYSTOREDPROCEDURE HAVING
                  COMPATIBLE ARGUMENTS WAS FOUND IN THE CURRENT PATH 
                  

                  我认为currentSchema"属性是错误的.

                  I assume that the "currentSchema" properties are wrong.

                  看起来我错了:属性 currentSchema 不是问题!SQL 语句 "select current_schema fromsysibm.sysdummy1" 返回正确的模式 (MYSCHEMA).现在的问题是,为什么 "CALL MYSCHEMA.MYSTOREDPROCEDURE(?)" 有效,而 "CALL MYSTOREDPROCEDURE(?)" 会导致错误...

                  It looks like I was wrong: the property currentSchema is not the problem! The SQL statement "select current_schema fromsysibm.sysdummy1" returns the correct schema (MYSCHEMA). The question is now, why "CALL MYSCHEMA.MYSTOREDPROCEDURE(?)" works and "CALL MYSTOREDPROCEDURE(?)" results in an error...

                  有什么建议吗?谢谢!

                  推荐答案

                  存储过程(和函数)解析不受 CURRENT SCHEMA 特殊寄存器控制.它由 CURRENT PATH 特殊寄存器控制.

                  Stored procedure (and function) resolution is not controlled by the CURRENT SCHEMA special register. It is controlled by the CURRENT PATH special register.

                  所以,你可以:

                  • 执行SQL语句SET CURRENT PATH = MYSCHEMA

                  使用 currentFunctionPath JDBC 属性.

                  Use the currentFunctionPath JDBC property.

                  这篇关于Weblogic:调用没有模式名称的 DB2 存储过程(属性 currentSchema)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何连接hibernate和DB2 下一篇:为什么 DB2 Type 4 JDBC Driver 正在寻找本机库 db2jcc

                  相关文章

                  最新文章

                2. <tfoot id='wvbMa'></tfoot>

                  <legend id='wvbMa'><style id='wvbMa'><dir id='wvbMa'><q id='wvbMa'></q></dir></style></legend>

                  <i id='wvbMa'><tr id='wvbMa'><dt id='wvbMa'><q id='wvbMa'><span id='wvbMa'><b id='wvbMa'><form id='wvbMa'><ins id='wvbMa'></ins><ul id='wvbMa'></ul><sub id='wvbMa'></sub></form><legend id='wvbMa'></legend><bdo id='wvbMa'><pre id='wvbMa'><center id='wvbMa'></center></pre></bdo></b><th id='wvbMa'></th></span></q></dt></tr></i><div id='wvbMa'><tfoot id='wvbMa'></tfoot><dl id='wvbMa'><fieldset id='wvbMa'></fieldset></dl></div>
                    <bdo id='wvbMa'></bdo><ul id='wvbMa'></ul>

                    1. <small id='wvbMa'></small><noframes id='wvbMa'>