1. <tfoot id='vQAf9'></tfoot>
      <legend id='vQAf9'><style id='vQAf9'><dir id='vQAf9'><q id='vQAf9'></q></dir></style></legend>

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

    3. <small id='vQAf9'></small><noframes id='vQAf9'>

        发生 DB2 连接授权失败原因:Java 中不支持安全机制

        时间:2023-09-30
          • <bdo id='KUW0R'></bdo><ul id='KUW0R'></ul>

              <tbody id='KUW0R'></tbody>

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

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

                • 本文介绍了发生 DB2 连接授权失败原因:Java 中不支持安全机制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试使用 DB2JDBC Type4 驱动程序配置 DB2 连接.但是我收到了这个错误.

                  I am trying to configure DB2 connection with DB2JDBC Type4 drivers. But I am getting this error.

                  线程main"中的异常com.ibm.db2.jcc.am.SqlInvalidAuthorizationSpecException:[jcc][t4][201][11237][3.64.104] 连接授权失败发生了.原因:不支持安全机制.错误代码=-4214,SQLSTATE=28000

                  Exception in thread "main" com.ibm.db2.jcc.am.SqlInvalidAuthorizationSpecException: [jcc][t4][201][11237][3.64.104] Connection authorization failure occurred. Reason: Security mechanism not supported. ERRORCODE=-4214, SQLSTATE=28000

                  我的代码是

                  public Connection getConnection() throws ClassNotFoundException, InstantiationException,
                                                           IllegalAccessException, SQLException{
                  
                     Driver driver = (Driver) Class.forName ( "com.ibm.db2.jcc.DB2Driver" ).newInstance(); 
                    DriverManager.registerDriver(driver);
                    Connection  connection = DriverManager.getConnection("jdbc:db2://hostname:portnumber
                                                             /DBName", "username","password" );
                      System.out.println( "From DAO, connection obtained " );
                      return connection;  
                  }
                  

                  异常日志:

                  Exception in thread "main" com.ibm.db2.jcc.am.SqlInvalidAuthorizationSpecException:
                  [jcc][t4][201][11237][3.64.104] Connection authorization failure occurred. 
                  Reason: Security mechanism not supported. ERRORCODE=-4214, SQLSTATE=28000
                      at com.ibm.db2.jcc.am.bd.a(bd.java:677)
                      at com.ibm.db2.jcc.am.bd.a(bd.java:60)
                      at com.ibm.db2.jcc.am.bd.a(bd.java:120)
                      at com.ibm.db2.jcc.t4.b.f(b.java:2389)
                      at com.ibm.db2.jcc.t4.b.a(b.java:1712)
                      at com.ibm.db2.jcc.t4.y.b(y.java:3612)
                      at com.ibm.db2.jcc.t4.y.a(y.java:477)
                      at com.ibm.db2.jcc.t4.y.a(y.java:117)
                      at com.ibm.db2.jcc.t4.b.c(b.java:1350)
                      at com.ibm.db2.jcc.t4.b.b(b.java:1221)
                      at com.ibm.db2.jcc.t4.b.b(b.java:788)
                      at com.ibm.db2.jcc.t4.b.a(b.java:760)
                      at com.ibm.db2.jcc.t4.b.a(b.java:421)
                      at com.ibm.db2.jcc.t4.b.a(b.java:396)
                      at com.ibm.db2.jcc.t4.b.<init>(b.java:334)
                      at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(DB2SimpleDataSource.java:232)
                      at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(DB2SimpleDataSource.java:198)
                      at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:475)
                      at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:116)
                      at java.sql.DriverManager.getConnection(DriverManager.java:582)
                      at java.sql.DriverManager.getConnection(DriverManager.java:185)
                      at com.test.connection.DB2ConnectionFactory.getConnection(DB2ConnectionFactory.java:19
                      at com.test.connection.ConnectionTest.main(ConnectionTest.java:18)
                  

                  我也尝试过 IBM Data Server Driver for JDBC and SQLJ 支持的这些机制

                  I also have tried these supported mechanisms by IBM Data Server Driver for JDBC and SQLJ

                  -CLIENT
                  -SERVER
                  -SERVER_ENCRYPT
                  -DATA_ENCRYPT
                  -KERBEROS
                  -GSSPLUGIN
                  -KRB_SERVER_ENCRYPT
                  -GSS_SERVER_ENCRYPT 
                  

                  为了避免加密问题,我们将此应用程序部署到 linux 机器上.所以如果需要安全连接,但那里发生同样的错误.

                  In order to avoid encryption problem we have deployed this application to linux box. SO in case need secure connection, but same error is occurring there.

                  我使用的是DB2 JDBC Driver版本v10.1fp1_jdbc_sqlj,我也试过9.59.1db2jcc4.jar 文件用于此目的.

                  I am using DB2 JDBC Driver version v10.1fp1_jdbc_sqlj, and I have also tried 9.5 and 9.1 and db2jcc4.jar file for this purpose.

                  我也尝试过使用 type 2 驱动程序,但在这种情况下 COM.ibm.db2.jdbc.app.DB2Driver 会出现 ClassNotFound 错误.找不到类.

                  I have also tried it using type 2 drivers, but I am getting ClassNotFound error in that case COM.ibm.db2.jdbc.app.DB2Driver. class not found.

                  但到目前为止没有任何效果.任何帮助表示赞赏.一个多星期以来,我一直在努力解决这个问题.

                  But nothing worked so far. Any help is appreciated. I am struggling with this problem over a week.

                  推荐答案

                  现在可以了.问题出在 DB2 上.您必须确保您的环境变量指向正确的文件夹.所以一定要做到以下几点:

                  It's working now. The problem was with DB2. You have to make sure that your environment variables point to the correct folders. So make sure to do the following:

                  • 每次更改或对环境变量进行所有更改后都必须重新启动计算机.
                  • 确保您使用的是 JDBC Type 2 驱动程序.除非您的 DBA 要求,否则不要选择 Type 4.
                  • Must reboot your machine after each change or after all the change you made to your environment variables.
                  • Make sure that you are using JDBC Type 2 drivers. Do not go for Type 4 unless asked by your DBA.

                  将帮助您确保您的代码能够与 Windows JDBC 驱动程序交互

                  Will help you to make sure that your code will be able to interact with Windows JDBC Drivers

                  PATH=C:Program FilesIBMSQLLIBBINdb2jdbc.dll
                  

                  LIB 将帮助您的代码读取正确的库.即 COM.ibm.db2.jdbc.app.DB2Driver

                  LIB will help your code to read right libraries. i.e COM.ibm.db2.jdbc.app.DB2Driver

                  LIB=;C:PROGRA~1IBMSQLLIBLIB
                  

                  类路径:

                  ClassPath = .;C:PROGRA~1IBMSQLLIBjavadb2java.jar;
                  C:PROGRA~1IBMSQLLIBjavadb2jcc.jar;C:PROGRA~1IBMSQLLIBjavasqlj.zip;
                  C:PROGRA~1IBMSQLLIBBINdb2jdbc.dll;
                  C:PROGRA~1IBMSQLLIBjavadb2jcc.jar;
                  C:PROGRA~1IBMSQLLIBjavasqlj.zip;
                  C:PROGRA~1IBMSQLLIBjavadb2jcc_license_cu.jar;
                  C:PROGRA~1IBMSQLLIBjavadb2java.jar;
                  C:PROGRA~1IBMSQLLIBBIN;C:PROGRA~1IBMSQLLIBjavajdk;
                  

                  这篇关于发生 DB2 连接授权失败原因:Java 中不支持安全机制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在 SQL 中使用 NOT EXISTS 和 COMPOSITE KEYS 从 POJ 下一篇:使用准备好的语句进行选择查询时出现 SQL 异常

                  相关文章

                  最新文章

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

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