About the installation deployment of FreeTDS pymssql
First, Installation:
(freetds-0.91 pymssql 2.0.1)
If you want to connect Mysqlsever on a Linux machine
1. Need to install FreeTDS
./configure
Make && make install
Test
Tsql-c viewing the installed version
Tsql-h 10.20.17.102-p 1433-u sa-p "password"-D dbanme Connection MySQLServer
> SELECT TOP 1 * FROM TableName
> Go
2.python program needs to use Pymssql
The installation can be tested.
Conn=pymssql.connect (host= ", database=", user= ", password=", charset= "UTF-8")
Cur=conn.cursor ()
Cur.execute ("Select TOP 1 * FROM tablename")
For I in Cur.fetchall ():
Print I
Conn.close ()
Ii. problems that may arise
1. If the Pymmsql is installed first, the rear-mounted FreeTDS
When import pymssql
Possible error "Importerror:libsybdb.so.5:cannot open shared object file:no such file or directory"
Need to re-install the pymssql
Still error
Can update ldconfig
2. If the use of FreeTDS is modified freetds.conf, or other reasons
Causes the Date field in the MySQLServer table to be queried with pymssql
Error "in _mssql. Mssqlconnection.convert_db_value (_mssql.c:7862)
Valueerror:month must is in 1..12 "
Workaround:
Uninstall the previously installed FreeTDS directly
Switch to compiled directory make uninstall
Manually remove RM-RF FreeTDS installed directories, and TSQL
Make sure TSQL doesn't work
Then repeat the installation process above
About the installation deployment of FreeTDS pymssql