About the installation deployment of FreeTDS pymssql

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.