In the past, I used python to access MSSQL and used a module called pymssql, which was used only in windows. For more information, see
Http://pymssql.sourceforge.net /.
Now you need to access MSSQL in Python in Linux and install freetds (http://www.freetds.org /). Since the pymssql source code could not be downloaded these days, Debian also did not download this package, had to use the python MSSQL module (http://object-craft.com.au/projects/mssql/examples.html) mentioned in the freetds document, download down to execute Python setup according to the document. PY install,
Compilation error. The following prompt is displayed:
Running install
Running build
Running build_py
Running build_ext
Building 'mssqldb' Extension
Gcc-pthread-fno-strict-aliasing-dndebug-g-O3-wall-wstrict-prototypes-FPIC-dhave_freetds-acceleration-dhave_dbcurcmd-dhave_dbcurrow-dhave_dbisopt-release-Acceleration- i/usr/include-I/home/hjue/Python-2.4.2/include-I/home/hjue/Python-2.4.2-C databuf. c-o build/temp. linux-i686-2.4/databuf. O
In file encoded ded from databuf. C: 9:
Mssqldb. h: 59: Error: syntax error at '# 'token
Mssqldb. h: 59: Error: syntax error at '# 'token
Mssqldb. h: 59: Error: syntax error at '# 'token
Mssqldb. h: 68: Error: 'dbmaxchar 'undeclared here (not in a function)
Mssqldb. h: 71: Error: syntax error at '# 'token
Mssqldb. h: 71: Error: syntax error at '# 'token
Mssqldb. h: 71: Error: syntax error at '# 'token
Error: Command 'gcc 'failed with exit status 1
I checked it on Google mainly because some MSSQL variables are not defined.
Add the following code to mssqldb. h and run Python setup. py install again.
# Define dbmaxchar 256
# Ifdef have_freetds
Typedef unsigned char dbbit;
# Define prnumeric maxprecision
# Define db_max_prec maxprecision
# Define db_max_scale maxprecision
Typedef struct dbvarychar
{
Dbsmallint Len;
Dbchar STR [dbmaxchar];
} Dbvarychar;
# Endif