pymssql

How to install pymssql on windows with python 2.7?

被刻印的时光 ゝ 提交于 2019-11-30 05:15:35
It seems that there are no such binaries yet. There is an issue on googlecode: http://code.google.com/p/pymssql/issues/detail?id=12 but i cannot figure out what to do with those files provided. You may also get pymssql2.7 library from this unofficial extensions library http://www.lfd.uci.edu/~gohlke/pythonlibs/#pymssql If you have pip install: pip install pymssql To install pip (trust me its very helpful): Download and run this python script (as admin): https://bootstrap.pypa.io/get-pip.py Extract the contents into the Python27\Lib\site-packages directory. Combining YOU and David Huang's

Import CSV file into SQL Server using Python

吃可爱长大的小学妹 提交于 2019-11-29 22:47:08
问题 I am having trouble uploading a CSV file into a table in MS SQL Server, The CSV file has 25 columns and the header has the same name as table in SQL which also has 25 columns. When I run the script it throws an error params arg (<class 'list'>) can be only a tuple or a dictionary What is the best way to import this data into MS SQL? Both the CSV and SQL table have the exact same column names. Here is the code: import csv import pymssql conn = pymssql.connect( server="xx.xxx.xx.90", port =

Unable to connect to SQL Server via pymssql

落花浮王杯 提交于 2019-11-29 09:48:17
I am attempting to connect to SQL Server running on Windows XP system from a *nix system on a local server via pymssql. However, the connection fails as shown below db = pymssql.connect(host='192.168.1.102',user='www',password='test',database='TestDB') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "pymssql.pyx", line 457, in pymssql.connect (pymssql.c:6041) raise InterfaceError(e[0]) pymssql.InterfaceError: Connection to the database failed for an unknown reason. Things I've tried: Set SQL Server and browser to run as a network server. Setup a user 'www'. I also

MSSQL in python 2.7

风格不统一 提交于 2019-11-28 15:58:58
Is there a module available for connection of MSSQL and python 2.7? I downloaded pymssql but it is for python 2.6. Is there any equivalent module for python 2.7? I am not aware of it if anyone can provide links. Important note: in the meantime there is a pymssql module available. Don't miss to read the answer at the end of this page: https://stackoverflow.com/a/25749269/362951 codeape You can also use pyodbc to connect to MSSQL from Python. An example from the documentation : import pyodbc cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=localhost;DATABASE=testdb;UID=me;PWD=pass') cursor =

Adaptive server connection failed (DB-Lib error message 20002, severity 9)

人走茶凉 提交于 2019-11-28 14:02:38
I'm sure this issue has been raised an uncountable number of times before but perhaps, someone could still help me. I am using pymssql v2.1.3 with Python 2.7.12 and the code that I used several times until yesterday to write data to my Azure SQL DB has somehow decided not to work anymore - for no apparent reason. The firewall is set, my IP is in the whitelist, I can connect to the database using SQL Server Management Studio and query the data but I still keep getting this error when attempting to connect using pymssql. The app is a Flask web-app and following is how I connect to the DB: conn =

How do you get output parameters from a stored procedure in Python?

我怕爱的太早我们不能终老 提交于 2019-11-28 07:16:06
问题 I've googled around a bit, but maybe I didn't put the correct magik incantation into the search box. Does anyone know how to get output parameters from a stored procedure in Python? I'm using pymssql to call a stored procedure, and I'm not sure of the correct syntax to get the output parameter back. I don't think I can use any other db modules since I'm running this from a Linux box to connect to a mssql database on a MS Server. import pymssql con = pymssql.connect(host='xxxxx',user='xxxx'

Unable to connect to SQL Server via pymssql

别等时光非礼了梦想. 提交于 2019-11-28 02:54:54
问题 I am attempting to connect to SQL Server running on Windows XP system from a *nix system on a local server via pymssql. However, the connection fails as shown below db = pymssql.connect(host='192.168.1.102',user='www',password='test',database='TestDB') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "pymssql.pyx", line 457, in pymssql.connect (pymssql.c:6041) raise InterfaceError(e[0]) pymssql.InterfaceError: Connection to the database failed for an unknown reason.

“ImportError: DLL load failed” when trying to import pymssql on Windows

南楼画角 提交于 2019-11-28 02:05:06
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

python SqlServer操作

吃可爱长大的小学妹 提交于 2019-11-28 01:07:47
python连接微软的sql server数据库用的第三方模块叫做pymssql(document:http://www.pymssql.org/en/stable/index.html)。在官方文档可以看到,pymssql是基于_mssql模块做的封装。打开:https://pypi.org/,搜索pymssql包,找到自己版本对应的下载入口。 命令 : pip install pymssql connect Cursor SqlServer_DB Demo callproc executemany 来源: https://www.cnblogs.com/tgzhu/p/11383479.html

pymssql: Connection to the database only works sometimes

試著忘記壹切 提交于 2019-11-28 00:17:49
I'm trying to connect to Azure SQL server using Python's pymssql. The problem is that the following script works but only sometimes, the other times I get this error: _mssql.MSSQLDatabaseException: (20002, b'DB-Lib error message 20002, severity 9:\nAdaptive Server connection failed\n') This is the script I'm using: import pymssql conn = pymssql.connect(server='x', user='x', password='x', database='x') cursor = conn.cursor() cursor.execute('SELECT * FROM customers'); row = cursor.fetchone() while row: print (str(row[0]) + " " + str(row[1]) + " " + str(row[2])) row = cursor.fetchone() It would