Questions tagged [pyodbc]

pyodbc is a module that allows you to use Python to make a database connection using ODBC

pyodbc is a Python 2.x and 3.x module that allows you to use ODBC to connect to almost any database from Windows, Linux, OS/X, and more.

It implements the Python Database API Specification v2.0, but additional features have been added to further simplify database programming.

pyodbc is licensed using an MIT license, so it is free for commercial and personal use. You can even use the source code in your own projects.

Installing can be done by running:

pip install pyodbc

Most Linux distributions are starting to provide pre-compiled packages, but those versions are often quite outdated.

Full source code is also available from the GitHub repository.

3768 questions
8
votes
3 answers

Neither DSN nor SERVER keyword supplied

I am trying to connect to SQL database slightly different ways: with and without use of parameter. Why without use of parameters works fine, but with use of parameters - gives me an error. Did I make a syntax error? I went through each letters and…
Serdia
  • 4,242
  • 22
  • 86
  • 159
8
votes
2 answers

Cannot find ODBC driver in AWS Lambda when using unixODBC

Objective: Connect to a MS SQL Server in AWS Lambda Error From AWS Lambda: START RequestId: 37951004-404b-11e7-98fd-5177b3a46ec6 Version: $LATEST module initialization error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver…
nujhong
  • 81
  • 2
  • 5
8
votes
2 answers

Connect to SQL Server Express Database with Python (Windows Authentication)

I've got a Java Program connected to my SQLServer Express Database. The code I used to connect is: Connection con = null; try { String url = "jdbc:sqlserver://GANESHA\\SQLEXPRESS:1434;databaseName=4YP;integratedSecurity=true"; …
8
votes
4 answers

Appending to a Pandas Dataframe From a pd.read_sql Output

I'm coming from R but need to do this in Python for various reasons. This very well could be a basic PEBKAC issue with my Python more than anything with Pandas, PyODBC or anything else. Please bear with me. My current Python 3 code: import pandas…
ClintWeathers
  • 576
  • 7
  • 22
8
votes
3 answers

How to get entire VARCHAR(MAX) column with Python pypyodbc

I have a Python program that connects to an MSSQL database using an ODBC connection. The Python library I'm using is pypyodbc. Here is my setup: Windows 8.1 x64 SQL Server 2014 x64 Python 2.7.9150 PyPyODBC 1.3.3 ODBC Driver: SQL Server Native…
CM-Dev
  • 373
  • 1
  • 5
  • 15
8
votes
2 answers

django-pyodbc-azure rollback error with previously working configuration - line 389

I've been using django-pyodbc-azure for a while on Linux, along with pydobc, FreeTDS and unixODBC to connect Django to SQL Server 2014. I ran into this problem with an application that had been working fine, and am having trouble debugging it. To…
FlipperPA
  • 13,607
  • 4
  • 39
  • 71
8
votes
1 answer

pyodbc INSERT INTO from a list

I am trying to insert data into an Access mdb file using a list as the source for the values. cursor.execute("select * from Components") cursor.executemany(""" INSERT INTO Components ([Database…
user3579106
  • 251
  • 1
  • 2
  • 9
8
votes
2 answers

Python MS Access Database Table Creation From Pandas Dataframe Using SQLAlchemy

I'm trying to create an MS Access database from Python and was wondering if it's possible to create a table directly from a pandas dataframe. I know that I can use pandas dataframe.to_sql() function to successfully write the dataframe to an SQLite…
Radical Edward
  • 5,234
  • 5
  • 21
  • 33
8
votes
1 answer

"Data source name not found and no default driver specified" with Access ODBC

My Softwares: Python 3.4 -64 bit PyODBC 64 bit MS office package Installed (32 bit) Problem: Now, I try to access MS Access 2010 installed in my computer using PYODBC. It does not work regardless of what I try. My error is always…
Jack_of_All_Trades
  • 10,942
  • 18
  • 58
  • 88
8
votes
1 answer

Can't connect to remote SQL Servers outside of network with PYODBC

I for some reason can't seem to connect to any SQL Server that is outside of our network, yet have no problem if I'm within the network via VPN. My code is as such for local connection: sql = pyodbc.connect( 'DRIVER={FreeTDS};' …
crookedleaf
  • 2,118
  • 4
  • 16
  • 38
8
votes
4 answers

Python pyodbc connections to IBM Netezza Erroring

So. This issue is almost exactly the same as the one discussed here -- but the fix (such as it is) discussed in that post doesn't fix things for me. I'm trying to use Python 2.7.5 and pyodbc 3.0.7 to connect from an Ubuntu 12.04 64bit machine to an…
Gastove
  • 896
  • 2
  • 10
  • 21
8
votes
1 answer

pyodbc does not throw on SQL Server error

I am trying to use pyodbc (with Python 2.7) to call a stored procedure to insert records into a SQL Server 2012 table. I am passing a temporary table. I dumped out my sql and when executed through the SQL Server Management console, it generated the…
gt6989b
  • 4,125
  • 8
  • 46
  • 64
8
votes
2 answers

Connecting to Microsoft SQL Server through pyODBC on Ubuntu

Am having an issue connecting to a Microsoft SQL Server instance from pyODBC within an Ubuntu (12.10) machine. The error I am getting back is: pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data Source name not found, and no default…
ToOsIK
  • 643
  • 2
  • 8
  • 18
8
votes
2 answers

How to install pyodbc 64-bit?

I have Python 2.7, MySQL 5.5, MySQL ODBC Connector 5.1, and pyodbc all installed on my computer, which is running Windows 7, 64-bit... Only problem is that everything is installed as 64-bit except pyodbc, which is 32-bit. When using easy_install…
aensm
  • 3,325
  • 9
  • 34
  • 44
7
votes
2 answers

[Driver Manager]Can't open lib '/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.9.so.1.1'

When I run $ python manage.py inspectdb --database=mssql_database I have the following error django.db.utils.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.9.so.1.1' : file not…
xralf
  • 3,312
  • 45
  • 129
  • 200