pyodbc

Access second result set of stored procedure with SQL or other work-around? Python\pyodbc

I'm using python\pyodbc and would like to access the second result set of a stored procedure. As near as I can tell, pyodbc does not support multiple result sets. Additionally, I can't modify the stored procedure. Are there any options to access the second result set using SQL or some other work-around? Perhaps create a second stored pro...

Connecting to MS SQL Server using python on linux with 'Windows Credentials'

Is there any way to connect to an MS SQL Server database with python on linux using Windows Domain Credentials? I can connect perfectly fine from my windows machine using Windows Credentials, but attempting to do the same from a linux python with pyodbs + freetds + unixodbc >>import pyodbc >>conn = pyodbc.connect("DRIVER={FreeTDS};SER...

Is there any pywin32 odbc connector documentation available?

What is a good pywin32 odbc connector documentation and tutorial on the web? ...

Common ways to connect to odbc from python on windows?

What library should I use to connect to odbc from python on windows? Is there a good alternative for pywin32 when it comes to odbc? What about pyodbc? http://code.google.com/p/pyodbc/ Any others? Which one is good documented, robust, actively maintained, what are you guys using? ...

PyODBC and Microsoft Access: Inconsistent results from simple query

I am using pyodbc, via Microsoft Jet, to access the data in a Microsoft Access 2003 database from a Python program. The Microsoft Access database comes from a third-party; I am only reading the data. I have generally been having success in extracting the data I need, but I recently noticed some discrepancies. I have boiled it down to ...

Using Sql Server with Django in production

Has anybody got recent experience with deploying a Django application with an SQL Server database back end? Our workplace is heavily invested in SQL Server and will not support Django if there isn't a sufficiently developed back end for it. I'm aware of mssql.django-pyodbc and django-mssql as unofficially supported back ends. Both proje...

using pyodbc on linux to insert unicode or utf-8 chars in a nvarchar mssql field

I am using Ubuntu 9.04 I have installed the following package versions: unixodbc and unixodbc-dev: 2.2.11-16build3 tdsodbc: 0.82-4 libsybdb5: 0.82-4 freetds-common and freetds-dev: 0.82-4 I have configured /etc/unixodbc.ini like this: [FreeTDS] Description = TDS driver (Sybase/MS SQL) Driver = /usr/lib/odbc/libt...

using pyodbc on ubuntu to insert a image field on SQL Server

I am using Ubuntu 9.04 I have installed the following package versions: unixodbc and unixodbc-dev: 2.2.11-16build3 tdsodbc: 0.82-4 libsybdb5: 0.82-4 freetds-common and freetds-dev: 0.82-4 python2.6-dev I have configured /etc/unixodbc.ini like this: [FreeTDS] Description = TDS driver (Sybase/MS SQL) Driver = /usr...

In Python, Using pyodbc, How Do You Perform Transactions?

I have a username which I must change in numerous (up to ~25) tables. (Yeah, I know.) An atomic transaction seems to be the way to go for this sort of thing. However, I do not know how to do this with pyodbc. I've seen various tutorials on atomic transactions before, but have never used them. The setup: Windows platform, Python 2.6,...

How to escape a hash (#) char in python?

I'm using pyodbc to query an AS400 (unfortunately), and some column names have hashes in them! Here is a small example: self.cursor.execute('select LPPLNM, LPPDR# from BSYDTAD.LADWJLFU') for row in self.cursor: p = Patient() p.last = row.LPPLNM p.pcp = row.LPPDR# I get errors like this obviously: AttributeError: 'pyodbc.R...

How to get pyodbc.connect to prompt?

In my C++ programs, I'm used to the connection process prompting for a missing password or letting you select your own connection. Whe I use pyodbc.connect(), an exception is generated instead. Traceback (most recent call last): File "<pyshell#41>", line 1, in <module> c=pyodbc.connect('') Error: ('IM002', '[IM002] [Microsoft][OD...

Python multiprocessing and database access with pyodbc "is not safe"?

The Problem: I am getting the following traceback and don't understand what it means or how to fix it: Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Python26\lib\multiprocessing\forking.py", line 342, in main self = load(from_parent) File "C:\Python26\lib\pickle.py", line 1370, in load r...

Avoiding MaxLocksPerFile via odbc connection to MS Access

Due to "circumstances beyond my control"tm, I am using sqlalchemy with an MS Access backend. I'm having an issue that the following code: def delete_imports(self, files_imported_uid): table_name = 'my_table' delete_raw = self.meta.tables[table_name].delete() self.engine.execute(delete_raw.where( self.meta.tables[tabl...

SQL queries through PYODBC fail silently on one machine, works on another

I am working on a program to automate parsing data from XML files and storing it into several databases. (Specifically the USGS realtime water quality service, if anyone's interested, at http://waterservices.usgs.gov/rest/WaterML-Interim-REST-Service.html) It's written in Python 2.5.1 using LXML and PYODBC. The databases are in Microso...

Using pyodbc to insert rows into a MS Access MDB, how do I escape the paramaters?

Hi, I'm using pyodbc to talk to a legacy Access 2000 .mdb file. I've got a cursor, and am trying to execute this: c.execute("INSERT INTO [Accounts] ([Name], [TypeID], [StatusID], [AccountCat], [id]) VALUES (?, ?, ?, ?, ?)", [u'test', 20, 10, 4, 2]) However, doing so results in pyodbc.Error: ('HYC00', '[HYC00] [Microsoft][ODBC Mic...

Using an ODBC application with a JDBC driver

My company uses Vertica. We have Python applications that connect to it with pyodbc. I do most of my development on a Mac (Snow Leopard) and unfortunately Vertica has not released ODBC drivers for Mac. They do have JDBC drivers though. I don't think developing in Jython is a good compromise. Is there any way to use JDBC drivers with...

Django-pyodbc SQL Server/freetds server connection problems on linux

Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnectW)') I'm migrating from developing on a windows development machine to Linux machine in production and I'm having issues with the freetds driver. As far as I can tell that error message means it ...

pyodbc on SQL Server - How can I do an insert and get the row ID back?

I'm using pyodbc with SQL Server 2000. I want to be able to insert a row and get the auto incremented row id value back? Any ideas? Here's what I have so far: cursor.execute("insert into products(id, name) values ('pyodbc', 'awesome library')") cnxn.commit() ...

Python - Linux - Connecting to MS SQL with Windows Credentials - FreeTDS+UnixODBC + pyodbc or pymssql

There doesn't seem to be any great instructions for setting this up. Does anyone have any good instructions? I am a linux noob so be gentle. I did see another post that is similar, but no real answer. I have a couple of problems. FreeTDS doesn't "seem" to be working. I am trying to connect and I get the following message using t...

How do I encode Unicode strings using pyodbc to save to a SAS dataset?

I'm using Python to read and write SAS datasets, using pyodbc and the SAS ODBC drivers. I can load the data perfectly well, but when I save the data, using something like: cursor.execute('insert into dataset.test VALUES (?)', u'testing') ... I get a pyodbc.Error: ('HY004', '[HY004] [Microsoft][ODBC Driver Manager] SQL data type out o...