pyodbc

Inserting values into a Access 2003 database from a Python application using pyodbc

可紊 提交于 2020-01-14 19:09:05
问题 I've checked stackoverflow a lot in the past and have always been able to find what I've been looking for, but I just can't seem to get this one to work so I'm asking my first question. I'm not really a programmer, but I mentioned Python at work and now I have a Python project. I was actually getting everything figured out alright, but inserting values into a database is throwing me for a loop. The Basic Problem: I have a form built using Python and tkinter. When a button on the form is

pyodbc fails without error

吃可爱长大的小学妹 提交于 2020-01-14 03:47:46
问题 Would be interested if someone can point me in the right direction. I have one very long stored proc (that also contains calls to other stored procs within it) that updates various tables. If I run the stored proc in management studio it runs fine. If I call it from pyodbc then: It runs for the same amount of time that it usually does I get no errors None of the tables its meant to update get updated I run pyodbc to execute stored procedures all the time and have no problems - I know there is

how to catch specific pyodbc error message

给你一囗甜甜゛ 提交于 2020-01-13 07:57:28
问题 I trid the following code, import pyodbc try: pyodbc.connect('DRIVER={%s};SERVER=%s;DATABASE=%s;UID=%s;PWD=%s' % (driver, server, database, uid, password)) except pyodbc.Error, err: logging.warn(err) The error message format i get is ('HY000', "[HY000] [MySQL][ODBC 5.1 Driver]Access denied for user 'root'@'192.168.2.27' (using password: YES) (1045) (SQLDriverConnect)") I want to receive just the message part of the error i.e. Access denied for user 'root'@'192.168.2.27'(using password: YES) I

How to use windows authentication to connect to MS SQL server from windows workstation in another domain with Python

拥有回忆 提交于 2020-01-12 07:43:09
问题 I'm trying to connect to SQL server 2000 installed on Windows server 2003 from Windows Server 2008 R2 using Python 3.4 and pyodbc module. Those servers are in different AD domains. Windows only authentication is enabled on SQL server and I can't change that. drv = '{SQL server}' svr = 'sql.my-domain.local' usr = 'my-domain.local\testuser' pwd = 'password' db = 'testdb' pyodbc.connect(driver=drv, server=svr, user=usr, password=pwd, database=db) The connection above fails with the following

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

倖福魔咒の 提交于 2020-01-09 02:29:16
问题 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 this: pyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)') I already looked at: pyodbc and ms access 2010 connection error Cannot connect to Access DB using pyodbc It is

Is it possible to use pyodbc to read Paradox tables that are open in the Paradox gui?

六眼飞鱼酱① 提交于 2020-01-07 04:25:06
问题 I'm working in a environment with a very poorly managed legacy Paradox database system. (I'm not the administrator.) I've been messing around with using pyodbc to interact with our tables, and the basic functionality seems to work. Here's some (working) test code: import pyodbc LOCATION = "C:\test" cnxn = pyodbc.connect(r"Driver={{Microsoft Paradox Driver (*.db )\}};DriverID=538;Fil=Paradox 5.X;DefaultDir={0};Dbq={0};CollatingSequence=ASCII;".format(LOCATION), autocommit=True, readonly=True)

Connect to MSSQL in Python2.7.11 (Windows 10 Professional)

你说的曾经没有我的故事 提交于 2020-01-07 02:35:29
问题 I tried to connect to a remote MSSQL server by using pymssql package but then I get "ImportError: No module named pymssql". Yes, I have done a pip install pymssql which worked. I also looked into installing Cython but it seems such install would give more headaches, so not worth to attempt with such. If I am not totally wrong, pymssql recuires Cython. The OS I am using is Windows 10 Professional. Remote connection to MSSQL does work, since at the other side of the office they are connected to

Read data into structured array with multiple dtypes

这一生的挚爱 提交于 2020-01-06 20:01:54
问题 I'm trying to read some data from SQL (using pyodbc) into a numpy structured array (I believe a structured array is required due to the multiple dtypes). import pyodbc import numpy as np cnxn = pyodbc.connect('DRIVER={SQL Server};Server=SERVER;Database=DB;Trusted_Connection=Yes;') cursor = cnxn.cursor() sql_ps = "select a, b from table" cursor.execute(sql_positions) p_data = cursor.fetchall() cnxn.close ndtype = np.dtype([('f1','>f8'),('f2','|S22')]) p_data = np.asarray(p_data, dtype=ndtype)

ValueError: character U+590048 is not in range [U+0000; U+10ffff] - MAC OS

大兔子大兔子 提交于 2020-01-06 06:31:21
问题 Could someone help me with the below error while connecting to Teradata from my Python environment. I'm using ODBC driver method and I've tried all the below existing methods to connect but no luck. Note: if you are using windows, you can directly use these methods, however the problem comes when you are on MAC OS (not for all though) USING TERADATA Module and SQL Alchemy. import teradata import pyodbc server='111.00.00.00' username = 'user' password = 'pwd' udaExec = teradata.UdaExec(appName

Hive ParseException in Drop Table Statement

一世执手 提交于 2020-01-05 06:55:10
问题 I'm using python and pyodbc module in particular to execute Hive queries on Hadoop. The portion of code triggering issue is like this: import pyodbc import pandas oConnexionString = 'Driver={ClouderaHive};[...]' oConnexion = pyodbc.connect(oConnexionString, autocommit=True) oConnexion.setencoding(encoding='utf-8') oQueryParameter = "select * from my_db.my_table;" oParameterData = pandas.read_sql(oQueryParameter, oConnexion) oCursor = oConnexion.cursor() for oRow in oParameterData.index: