pyodbc

Connecting to MS Access 2007 (.accdb) database using pyodbc

徘徊边缘 提交于 2019-12-18 03:39:34
问题 I am on Win7 x64, using Python 2.7.1 x64. I am porting an application I created in VC++ to Python for educational purpouses. The original application has no problem connecting to the MS Access 2007 format DB file by using the following connection string: OleDbConnection^ conn = gcnew OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=|DataDirectory|DB.accdb"); Now, when I try to connect to the same DB file (put in C:\ this time) in Python using pyodbc and the following conenction

Connecting to MS Access 2007 (.accdb) database using pyodbc

偶尔善良 提交于 2019-12-18 03:39:25
问题 I am on Win7 x64, using Python 2.7.1 x64. I am porting an application I created in VC++ to Python for educational purpouses. The original application has no problem connecting to the MS Access 2007 format DB file by using the following connection string: OleDbConnection^ conn = gcnew OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=|DataDirectory|DB.accdb"); Now, when I try to connect to the same DB file (put in C:\ this time) in Python using pyodbc and the following conenction

pyodbc insert into sql

烂漫一生 提交于 2019-12-17 22:36:04
问题 I use a MS SQL express db. I can connect and fetch data. But inserting data does not work: cursor.execute("insert into [mydb].[dbo].[ConvertToolLog] ([Message]) values('test')") I get no error but nothing is inserted into the table. Directly after I fetch the data the inserted row is fetched. But nothing is saved. In MS SQL Server Management Studio the insertion does work. 回答1: You need to commit the data. Each SQL command is in a transaction and the transaction must be committed to write the

Using Sql Server with Django in production

谁说我不能喝 提交于 2019-12-17 21:45:14
问题 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 projects seem to have only one person contributing which is a bit of a worry though the contributions seem to be somewhat regular. Are there any other back ends for

Can't insert Date and Time to sql server via pyodbc

折月煮酒 提交于 2019-12-17 21:23:55
问题 I'm trying to insert date and time to SQL server in Linux (raspbian) environment using python language.So far i was able connect to MS Sql and also i created a table and im using pyodbc. #! /user/bin/env python import pyodbc import datetime dsn = 'nicedcn' user = myid password = mypass database = myDB con_string = 'DSN=%s;UID=%s;PWD=%s;DATABASE=%s;' % (dsn, user, password, database) cnxn = pyodbc.connect(con_string) cursor = cnxn.cursor() string = "CREATE TABLE Database3([row name] varchar(20

How can i connect to local advantage database using pyodbc in python?

拥有回忆 提交于 2019-12-17 21:14:32
问题 As far as i can understand to use pyodbc you have to cnxn = pyodbc.connect('DRIVER={Advantage ODBC Driver};SERVER=local;DataDirectory=\\AltaDemo\Demo\AltaPoint.add;DATABASE=AltaPoint;UID=admin;PWD=admin;ServerTypes=1;') cursor = cnxn.cursor() This is the error i get from the console when i run this Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)') 回答1: The name of the driver is Advantage StreamlineSQL

错误:找不到vcvarsall.bat

若如初见. 提交于 2019-12-17 21:04:09
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 我试图安装Python软件包 dulwich : pip install dulwich 但是我收到了一个神秘的错误消息: error: Unable to find vcvarsall.bat 如果我尝试手动安装软件包,也会发生相同的情况: > python setup.py install running build_ext building 'dulwich._objects' extension error: Unable to find vcvarsall.bat #1楼 我只是遇到了同样的问题,所以我在这里讲述我的故事,希望它可以帮助遇到同样问题的其他人,并为他们节省几个小时的时间: 我在Windows 7盒子中有mingw(g ++(GCC)4.6.1)和python 2.7.3,我正在尝试安装PyCrypto。 运行setup.py install时,所有错误均始于此错误: error: Unable to find vcvarsall.bat 通过将mingw指定为首选编译器,可以轻松地在搜索错误之后解决: setup.py install build --compiler=mingw32 问题是然后我得到了另一个错误: configure: error: cannot run C

ODBC Driver 13 for SQL Server can't open lib on pyodbc while connecting on AWS E2 ubuntu instance

半城伤御伤魂 提交于 2019-12-17 19:21:48
问题 Background: i have been at it for about a week but still no luck. the same driver (13.0) on my system (Ubuntu 16.04.1 LTS) works just fine with my pyodbc python (Python 2.7.12 :: Anaconda 4.1.1 (64-bit)) library. i tried setting up a virtual machine on AWS E2 but it does not work there as described below. Objective: Connect to Azure SQL Server using Python 2.7.12 :: Anaconda 4.2.0 (64-bit) with official ODBC Driver from Microsoft on Amazon Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-53-generic x86_64

How to execute query saved in MS Access using pyodbc

霸气de小男生 提交于 2019-12-17 16:53:40
问题 There are a lot of tips online on how to use pyodbc to run a query in MS Access 2007, but all those queries are coded in the Python script itself. I would like to use pyodbc to call the queries already saved in MS Access. How can I do that? 回答1: If the saved query in Access is a simple SELECT query with no parameters then the Access ODBC driver exposes it as a View so all you need to do is use the query name just like it was a table: import pyodbc connStr = ( r"Driver={Microsoft Access Driver

MSSQL2008 - Pyodbc - Previous SQL was not a query

对着背影说爱祢 提交于 2019-12-17 15:49:06
问题 I can't figure out what's wrong with the following code, The syntax IS ok (checked with SQL Management Studio), i have access as i should so that works too.. but for some reason as soon as i try to create a table via PyODBC then it stops working. import pyodbc def SQL(QUERY, target = '...', DB = '...'): cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=' + target + DB+';UID=user;PWD=pass') cursor = cnxn.cursor() cursor.execute(QUERY) cpn = [] for row in cursor: cpn.append(row) return cpn