pymssql

Insert byte into sql server varbinary(max) column using pymssql

落爺英雄遲暮 提交于 2019-12-11 07:36:37
问题 I'm attempting to insert a byte or byte array into Sql Server table using Python 3.5 and the pymssql package. I keep getting a pymssql.ProgrammingError after attempting to insert. I've used the following link and question as a reference but I'm still having trouble: Explicit Convert of Varbinary(max) column Insert binary file into MSSQL db (varbinary) with python pymssql I've verified I have permission and can insert other data types into the sql server database. Below is the table structure.

pyodbc doesn't report sql server error

邮差的信 提交于 2019-12-11 03:32:38
问题 I have an issue where pyodbc doesn't capture errors returned from stored procedure. My actual stored proc does a lot of stuff but for the purpose of demonstrating the error I created a simple proc and associated python code. Relevant code is below: Stored Procedure: CREATE PROCEDURE [dbo].[testErrors] -- Add the parameters for the stored procedure here AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements

copy data from MSSQL database to Postgresql database with Python

删除回忆录丶 提交于 2019-12-11 03:09:52
问题 I have two 2 databases. One with MSSQL and another with Postgresql. I want that my python script is running (for this I use a cron-job on linux), every day. The data from the MSSQL database should copied to the Postgresql database. I have an idea but it doesn't works. Could you help me??? Maybe my solution is totally wrong... That's my code: import pymssql, psycopg2 class DatabaseRequest: def __init__(self): self.conn1 = pymssql.connect(host='****', user='****', password='****', database='***

SQL Server log in failing from Java DriverManager.getConnection(), working from Python with pymssql.connect()

馋奶兔 提交于 2019-12-11 01:22:27
问题 I'm trying to use DriverManager.getConnection() to connect to a SQL Server db from a Java application, but I keep getting "Login failed for user" errors with it. I've tried using both com.microsoft.sqlserver.jdbc.SQLServerDriver and net.sourceforge.jtds.jdbc.Driver to connect, but both keep hitting the issue. Here's the code I'm using to connect: Class.forName("net.sourceforge.jtds.jdbc.Driver"); conn=DriverManager.getConnection("jdbc:jtds:sqlserver://SERVERADDRESS:1433;DatabaseName=DBNAME

Unable to connect using pymssql with windows authentication

时光怂恿深爱的人放手 提交于 2019-12-10 21:02:57
问题 While trying to connect to MSSQL Server 2012 using pymssql, I get the following error. My server name in Windows Authentication is SARATH,User Name is Sarath\SarathShanker and I did not set a password. Code: mssql_conn=pymssql.connect(host='SARATH',user='Sarath\SarathShanker',password='',database='matrix') Error: Traceback (most recent call last): File "", line 1, in File "pymssql.pyx", line 556, in pymssql.connect (pymssql.c:7990) pymssql.OperationalError: (18452, 'Login failed. The login is

Error while install pymssql in centos 7

旧城冷巷雨未停 提交于 2019-12-10 13:58:05
问题 I have faced the issue while installing the pymssql in my virtual machine (Centos 7) I had python installed version 2.7.6 Command used to install pymssql , pip intall pymssql Error information; [root@dpitstsvr013 magendran]# pip install pymssql Downloading/unpacking pymssql Downloading pymssql-2.1.1.tar.gz (2.4MB): 2.4MB downloaded Running setup.py (path:/tmp/pip_build_root/pymssql/setup.py) egg_info for package pymssql setup.py: platform.system() => 'Linux' setup.py: platform.architecture()

sqlalchemy pymssql “connection reset by peer” recovery

不羁的心 提交于 2019-12-10 11:50:14
问题 I'm running a cherrypy webservice and wondering what the best option is to recover from "connection reset by peer" for a pymssql connection via sqlalchemy. Right now I have to restart the webservice. 回答1: This seems to be a bug in the is_disconnect() method for pymssql where it ignore TCP connection and timeout failures, leaving the cursor in an unhappy state; see http://www.sqlalchemy.org/trac/ticket/2172. For now, you can monkey-patch as: from sqlalchemy.dialects.mssql import pymssql def is

Where is FreeTDS installed when I download pymssql on windows?

筅森魡賤 提交于 2019-12-10 10:37:29
问题 I am having trouble connecting pymssql to my local instance of MSSQL, and would like to use the tsql debugging command that is included with FreeTDS. However, I am unable to find where it FreeTDS is installed. As far as I know, it comes pre-compiled with pymssql on windows, I just don't know where it is. More info: I am using windows I am not using a virtual environment I used the package manager included with PyCharm to install pymssql (I assume it wraps pip ) 回答1: AKAIK, pymssql for Windows

Connect to SQL Server instance using pymssql on Windows

十年热恋 提交于 2019-12-10 03:19:06
问题 I'm attempting to connect to a SQL Server instance from a Windows box using pymssql (version 2.0.0b1-dev-20111019 with Python 2.7.1). I've tried the most basic approach from the console: import pymssql c = pymssql.connect(host = r'servername\instance', user = 'username', password = 'userpassword') In response to this, I get the very helpful error: InterfaceError: Connection to the database failed for an unknown reason. I am reasonably confident that the connection information is correct, as

Why can I connect to Azure MS SQL with tsql but not pymssql?

此生再无相见时 提交于 2019-12-08 00:35:06
问题 Where I am today: TDSVER=7.3 tsql -H example.database.windows.net -U me -D ExampleDB -p 1433 -P notreallymypassword This does not: >>> import pymssql >>> pymssql.connect('example.database.windows.net', user='me', password='notreallymypassword', database='ExampleDB', tds_version='7.3') It fails with Traceback (most recent call last): File "<stdin>", line 1, in <module> File "pymssql.pyx", line 635, in pymssql.connect (pymssql.c:10734) File "_mssql.pyx", line 1902, in _mssql.connect (_mssql.c