【问题标题】:How can i connect to local advantage database using pyodbc in python?如何在 python 中使用 pyodbc 连接到本地优势数据库?
【发布时间】:2015-11-04 21:48:58
【问题描述】:

据我所知,使用 pyodbc 你必须

 cnxn = pyodbc.connect('DRIVER={Advantage ODBC Driver};SERVER=local;DataDirectory=\\AltaDemo\Demo\AltaPoint.add;DATABASE=AltaPoint;UID=admin;PWD=admin;ServerTypes=1;')
 cursor = cnxn.cursor()

这是我在运行时从控制台得到的错误 错误: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')

【问题讨论】:

    标签: python odbc pyodbc advantage-database-server


    【解决方案1】:

    驱动的名字是Advantage StreamlineSQL ODBC,所以最小的连接字符串是:

    DRIVER={Advantage StreamlineSQL ODBC};DataDirectory=D:\Temp
    

    其他可选选项有:

    DefaultType=Advantage
    User ID=xxx
    Password=xxx
    ServerTypes=2
    AdvantageLocking=ON
    CharSet=ANSI
    Language=ANSI
    Description=My ADS connection
    Locking=Record
    MaxTableCloseCache=25
    MemoBlockSize=64
    Rows=False
    Compression=Internet
    CommType=TCP_IP
    TLSCertificate=     
    TLSCommonName=
    TLSCiphers=
    DDPassword=Dictionary Password
    EncryptionType=
    FIPS=False
    TrimTrailingSpaces=True
    SQLTimeout=600
    RightsChecking=OFF    
    

    如果你想使用本地服务器,你必须像原来的字符串一样传递ServerTypes=1

    有关更多选项和文档,另请参阅:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-18
      相关资源
      最近更新 更多