Questions tagged [pypyodbc]

pypyodbc is a pure Python ODBC interface module. (Not to be confused with pyodbc, which performs many of the same functions but was written as an *extension module* in C++.)

pypyodbc is a pure Python interface module. It is very similar to , which performs many of the same functions but was written as an extension module in C++.

In addition to being a very good ODBC Library in its own right, pypyodbc is a useful alternative to pyodbc in situations where pyodbc encounters difficulties.

For more information, see

pypyodbc - A Pure Python ODBC Library

Installation is available from pip:

pip install pypyodbc

Or by downloading installation package. (Unzip, navigate to folder, and run:)

python setup.py install
285 questions
2
votes
1 answer

Byte string too long PyPyOdbc

Using FreeTDS and Python3.5 library PyPyodbc I am getting a 'Byte string too long' when trying to insert a row in the SQL Server database (residing on Windows). Under FreeTDS conf file there is a vairable 'text size' that I changed to: [global] text…
user0187409
  • 239
  • 1
  • 4
  • 13
2
votes
2 answers

I have error 'Attempt to use a closed connection.'

I have some problems with my code. So, I want to add data to Accces by writing it in the form. (I am not so good in programming). from tkinter import * import pypyodbc import ctypes form=Tk () form.title ("Add data") form.geometry…
Baga
  • 39
  • 1
  • 6
2
votes
0 answers

How to properly connect to sql server in python using pypyodb

When I type in the code: connection = pypyodbc.connect(driver='{SQL Server}', server=ServerName, database=DatabaseName, uid=UserId, pwd=Password) I get this error: ProgrammingError: (u'42000', u"[42000] [Microsoft][ODBC SQL Server Driver][SQL…
nd002
  • 21
  • 2
2
votes
1 answer

Getting error while creating pypyodbc connection python

i am trying to connect a database in sql server using pypyodbc in ubuntu. below is my code: import pandas as pd import pypyodbc host = "servername" username = "sa" password = "sa@12" database = "dbname" try: conn = pypyodbc.connect("DRIVER={SQL…
Shubham R
  • 7,382
  • 18
  • 53
  • 119
2
votes
1 answer

Cannot run mssql select query with where clause within python using pypyodbc

I am using the library pypyodbc and am trying to run a select query in mssql using a where clause. However the error I am getting indicates the syntax is wrong. Error here ('42000', "[42000] [FreeTDS][SQL Server]Incorrect syntax near the keyword…
mp252
  • 453
  • 1
  • 6
  • 18
2
votes
1 answer

How do I place a tkinter variable in a Pypyodbc server name?

I am pulling a variable from the user when they select one of the radio buttons I provide them. Each radio button variable is set as an actual server I can normally connect to using MsSql. My below code has a !!!!!!!!!!!!! MY EXAMPLE …
Prox
  • 699
  • 5
  • 11
  • 33
2
votes
1 answer

PyPyODBC not inserting record to MS-SQL server

I'm new to Python and wrote this simple code for inserting data to the SQL server: import pypyodbc connect = pypyodbc.connect('Driver={Sql Server Native Client 11.0};Server=.;Database=SAMPLE;Trusted_Connection=yes;') cursor =…
chert chertopert
  • 197
  • 3
  • 14
2
votes
1 answer

Python - pass a list as params to SQL, plus more variables

I'm trying to pass a an unknown number of params to SQL Server in python 3.6. Here is my code using pypyodbc: cursor = cnxn.cursor() theargs= ['1033286869','1053474957','1063654630','1104116235','1104910306','JASON'] thesql = """SELECT * …
sniperd
  • 5,124
  • 6
  • 28
  • 44
2
votes
1 answer

How do I enter a SQL Server Name in PYPYODBC which has a backslash in the server name?

I'm having difficulties trying to connect to a SQL Server instance in pypyodbc. The server name has a backslash in it eg "servername\something", instead of just the servername. In pypyodbc, i've tried all different…
vksf
  • 25
  • 4
2
votes
1 answer

"(u'24000', u'[24000] [Microsoft][ODBC SQL Server Driver]Invalid Cursor State)" in python pypyodbc

I want to execute the procedure and get the output parameters import pypyodbc command = "DECLARE @l_Stat INT \r\n" \ "DECLARE @s_Ms VARCHAR(200) \r\n" \ "EXEC p_Log_InsertParam_2011v1 " \ …
2
votes
1 answer

How to avoid conversion to ASCII when reading

I'm using Python to read values from SQL Server (pypyodbc) and insert them into PostgreSQL (psycopg2) A value in the NAME field has come up that is causing errors: Montaño The value is existing in my MSSQL database just fine…
DPSSpatial
  • 767
  • 3
  • 11
  • 31
2
votes
0 answers

pypyodbc crashes with 'Invalid string or buffer length' on x64

I try to import data to my MSSQL database, however sometimes(! around 9 of 10 times) the code crashes on a Python x64 platform. [HY090] [Microsoft][ODBC Driver Manager] Invalid string or buffer length The same code runs fine on 32-bit. The code…
Peter Parker
  • 29,093
  • 5
  • 52
  • 80
2
votes
0 answers

pypyodbc ODBC Driver Manager Invalid string or buffer length error

I am using pypyodbc from within a specialized called Motionbuilder, and recently I've been getting this strange error: pypyodbc.Error: (u'HY090', u'[HY090] [Microsoft][ODBC Driver Manager] Invalid string or buffer length') It doesn't happen every…
2
votes
1 answer

pypyodbc - Reusing a Database Connection

I have two questions: QUESTION-1: Suppose I have two .py File-1 and File-2 File-1 contains the following statements: try: cononnection = pypyodbc.connect('DRIVER={SQL Server};' 'SERVER=........' …
Newbie
  • 95
  • 9
2
votes
1 answer

"Execution failed on sql" for specific table name using pandas.read_sql and MSAccess

The weirdest thing is happening. I am connecting to an Access DB using pypyodbc and pandas.io.sql in Python 2.7 32 bit. The following code works perfectly with pretty ANY table name (table_name): var = psql.read_sql("SELECT * FROM…
David
  • 327
  • 1
  • 3
  • 11