db2 as400 I系列JDBC Connect

ax6ht2ek  于 12个月前  发布在  DB2
关注(0)|答案(1)|浏览(184)

我一直试图连接as400(IBM DB2 i系列)服务器使用JDBC然而我写的代码既不给任何异常也不打印任何东西.可以任何一个请帮助,如果我做错了什么或需要改变任何服务器端配置.

import jaydebeapi
import os
import configparser

class IbmDb2(object):

        def __init__(self):
            
            print("Initializing...")
            self.thisfolder = os.path.dirname(os.path.abspath(os.path.join(__file__, "..")))
            self.configfile = os.path.join(self.thisfolder, 'config', 'config.ini')
            self.config = configparser.ConfigParser()
            self.config_read = self.config.read(self.configfile)
            
            self.driver = self.config.get('DRIVER', 'driver')
            self.user = self.config.get('USER', 'user')
            self.password = self.config.get('PASSWORD', 'password')
            
            # Load the Netsuite JDBC driver
            self.jar_path = os.path.join(self.thisfolder, 'jars', "jt400.jar")
            print(f"JAR Path: {self.jar_path}")
            self.conn_str = "jdbc:as400://XX.XX.XX.XX:9099/WM410BASD"
            
            self.connection = jaydebeapi.connect(self.driver, self.conn_str, [self.user, self.password] , 'C:/google_analytics_data/db2-to-bq/jars/jt400.jar', )
            print(self.connection)
            print("Connection success")

            # Establish the connection
            self.cursor = self.connection.cursor()
            self.cursor.execute('select count(*) from WM410BASD.PHPICK00')
            results = self.cursor.fetchall()
            print(results)
            self.connection.close()

if __name__ == "__main__":
    db2data = IbmDb2()

字符串

5cnsuln7

5cnsuln71#

检查您的CPF9898消息序列。它们表示授权错误。您应该在QSECOFR或用户日志中找到它们。您还可以检查用户上次登录或无效密码检查。

相关问题