【问题标题】:('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'IBM i Access ODBC Driver 64-bit' : file not found (0) (SQLDriverConnect)") None('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'IBM i Access ODBC Driver 64-bit' : file not found (0) (SQLDriverConnect)") 无
【发布时间】:2021-08-06 20:56:17
【问题描述】:

我正在尝试使用 unixODBC 驱动程序将 I 系列驱动程序与 pyodbc 一起使用,但我在连接时遇到问题
Pyodc v- 4.0.31
ibmiaccess 1..1.0.15-1.0

('01000', "[01000] [unixODBC][Driver Manager]无法打开 lib 'IBM i Access ODBC Driver 64-bit': 找不到文件 (0) (SQLDriverConnect)") 无

avail = pyodbc.drivers()
print (avail)
drivers = [item for item in pyodbc.drivers()]
driver = drivers[-1]
sys = 'xxxxxxxxx'
uname = 'dbuser'
pas ='xxxxxx'
try:
    connection = pyodbc.connect(
    DRIVER= {driver} ,   
    system= {sys},
    uid= {uname},
    pwd={pas},
    autocommit=True)
    
    cursor = connection.cursor()
    cursor.execute(query)
    x = cursor.fetchall()
    
except Exception as e:
        print(e)
        x = None

finally:
    exit

我能够连接到 isql -v

#isql -v dbuser
    +---------------------------------------+
    | Connected!                            |
    |                                       |
    | sql-statement                         |
    | help [tablename]                      |
    | quit                                  |
    |                                       |
    +---------------------------------------+
    
    configured odbcinist.ini and odbc.ini follows :
    [ODBC Data Sources]
    dbuser = IBM i Access ODBC Driver 64-bit
    Default = IBM i Access ODBC Driver 64-bit
    
    [dbuser]
    Description             = IBM i Access ODBC Driver 64-bit
    Driver                  = IBM i Access ODBC Driver 64-bit
    System                  = xxxxxxx
    UserID                  = xxxx
    Password                = xxxx
    Naming                  = 0
    DefaultLibraries        = QGPL
    Database                =
    ConnectionType          = 0
    CommitMode              = 2
    ExtendedDynamic         = 1
    DefaultPkgLibrary       = QGPL
    DefaultPackage          = A/DEFAULT(IBM),2,0,1,0,512
    AllowDataCompression    = 1
    MaxFieldLength          = 32
    BlockFetch              = 1
    BlockSizeKB             = 128
    ExtendedColInfo         = 0
    LibraryView             = ENU
    AllowUnsupportedChar    = 0
    ForceTranslation        = 0
    Trace                   = 0
 -----------------------------------   
    
    [IBM i Access ODBC Driver]
    Description=IBM i Access for Linux ODBC Driver
    Driver=/opt/ibm/iaccess/lib/libcwbodbc.so
    Setup=/opt/ibm/iaccess/lib/libcwbodbcs.so
    Driver64=/opt/ibm/iaccess/lib64/libcwbodbc.so
    Setup64=/opt/ibm/iaccess/lib64/libcwbodbcs.so
    Threading=0
    DontDLClose=1
    UsageCount=1
    
    [IBM i Access ODBC Driver 64-bit]
    Description=IBM i Access for Linux 64-bit ODBC Driver
    Driver=/opt/ibm/iaccess/lib64/libcwbodbc.so
    Setup=/opt/ibm/iaccess/lib64/libcwbodbcs.so
    Threading=0
    DontDLClose=1
    UsageCount=1

也链接了
任何帮助都非常感谢您提前!!!

【问题讨论】:

    标签: python linux odbc pyodbc


    【解决方案1】:

    不熟悉您的设置,但如果我在连接到驱动程序时收到“未找到文件”,则未找到的文件通常是 .so 文件。在最简单的情况下,驱动程序只是丢失且未安装。我遇到的更模糊的情况是 32Bit / 64Bit 不匹配,或者缺少驱动程序的依赖项(如系统上未安装的 .so 文件中)。使用ldd 可以向您展示您的驱动程序所依赖的所有动态库。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-10-16
      • 1970-01-01
      • 1970-01-01
      • 2021-02-03
      • 2015-10-10
      • 2018-08-24
      • 2014-02-09
      相关资源
      最近更新 更多