我正在尝试通过python连接到SQL Anywhere数据库。我已经创建了DSN,并且可以使用命令提示符使用dbisql - c "DNS=myDSN"连接到数据库。当我尝试使用con = sqlanydb.connect(DSN= "myDSN")通过python连接时
我懂了

`Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    con = sqlanydb.connect(DSN= "RPS Integration")
  File "C:\Python27\lib\site-packages\sqlanydb.py", line 522, in connect
    return Connection(args, kwargs)
  File "C:\Python27\lib\site-packages\sqlanydb.py", line 538, in __init__
    parent = Connection.cls_parent = Root("PYTHON")
  File "C:\Python27\lib\site-packages\sqlanydb.py", line 464, in __init__
    'libdbcapi_r.dylib')
  File "C:\Python27\lib\site-packages\sqlanydb.py", line 456, in load_library
    raise InterfaceError("Could not load dbcapi.  Tried: " + ','.join(map(str, names)))
InterfaceError: (u'Could not load dbcapi.  Tried: None,dbcapi.dll,libdbcapi_r.so,libdbcapi_r.dylib', 0)`

最佳答案

我能够解决问题。我从未能够使用sqlanydb.connect。我最终使用了pyodbc。所以我最后的连接字符串是con = pydobc.connect(dsn="myDSN")。我认为sqlanydb仅与sqlanydb 17完全兼容,并且我使用的是以前的版本。

关于python - sqlanydb Windows无法加载dbcapi,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/52723924/

10-10 18:17