How can i connect to local advantage database using pyodbc in python?

后端 未结 1 711
面向向阳花
面向向阳花 2020-12-12 02:42

As far as i can understand to use pyodbc you have to

 cnxn = pyodbc.connect(\'DRIVER={Advantage ODBC Driver};SERVER=local;DataDirectory=\\\\AltaDemo\\Demo\\         


        
相关标签:
1条回答
  • 2020-12-12 03:36

    The name of the driver is Advantage StreamlineSQL ODBC, so the bare minimum connect string is:

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

    Other optinal options are:

    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    
    

    If you want to use the Local Server you have to pass ServerTypes=1 like you already have in your original string.

    For more options and documentation see also:

    • The official documentation
    • ConnectionStrings.com
    0 讨论(0)
提交回复
热议问题