I'm trying to use the example code from here:
http://www.pymssql.org/en/latest/pymssql_examples.html
I installed the pymmsql module using pip
. I also see it in the site-packages folder
C:\Python27\Lib\site-packages\pymmsql.pyd
But, when I execute the code, I get the following error:
Traceback (most recent call last):
File "C:\Android\android_workspace\pythonProject\test.py", line 2, in <module>
import pymssql
ImportError: DLL load failed: The specified module could not be found.
What am I missing?
Update
Due to negative feedback from the user community regarding the 2.1.2 change, pymssql 2.1.3 has reverted to shipping the Windows version statically linked to FreeTDS without SSL support.
Version 2.1.2 of pymssql introduced a significant change in the way it needs to be set up on Windows. Previous versions were distributed with FreeTDS statically linked so all we needed to do was install pymssql (e.g., pip install pymssql
) and it "just worked", but SSL connections were not supported.
Beginning with pymssql version 2.1.2, pymssql is dynamically linked with FreeTDS on Windows and does not ship with the required components of FreeTDS (and OpenSSL, if required). We can still install pymssql itself using pip install pymssql
, but that may no longer be sufficient. If we don't already have a working installation of FreeTDS on the Windows machine then we have to download the components ourselves.
The download links can be found on the pymssql documentation page here:
pymssql - Docs - FreeTDS - Installation - Windows.
If an SSL connection is not required then we just have to download the FreeTDS components and ensure that the contents of the "lib-nossl" folder can be found by searching the Windows PATH
.
If an SSL connection is required then we have to download both the FreeTDS and OpenSSL components and ensure that the appropriate DLLs (in the "lib" folder for FreeTDS, and in the "bin" or "bin64" folder for OpenSSL) can be located by searching the Windows PATH
.
Note that these changes affect both new installs and upgrades of pymssql. It has been reported that simply upgrading pymssql from version 2.1.1 to version 2.1.2 will break pymssql on Windows until the required components of FreeTDS (and OpenSSL, if required) are downloaded.
I had this issue. The simplest solution for me was just to uninstall 2.1.2 then install 2.1.1:
pip uninstall pymssql
pip install "pymssql==2.1.1"