PyODBC : can't open the driver even if it exists

后端 未结 7 1128
一向
一向 2020-12-31 01:03

I\'m new to the linux world and I want to query a Microsoft SQL Server from Python. I used it on Windows and it was perfectly fine but in Linux it\'s quite painful.

7条回答
  •  醉酒成梦
    2020-12-31 01:27

    I solve this problem after installing libssl1.0.0.

    First, I setup my connection string in this way:

        cnxn = pyodbc.connect('DRIVER={/usr/local/lib/libmsodbcsql.13.dylib};   
        SERVER=myServerIP,1433;DATABASE=myDBName;UID=sa;PWD=dbPassword')
    

    Then, I installed libssl1.0.0:

        echo "deb http://security.debian.org/debian-security jessie/updates main" >> /etc/apt/sources.list
        apt-get install libssl1.0.0
    

    Finnaly, I setup the locales:

        apt-get -y install locales 
        echo "en_US.UTF-8 UTF-8" > /etc/locale.gen 
    

    After doing these steps, my python module was able to find and connect to database.

提交回复
热议问题