473,748 Members | 2,575 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Understanding mxODBC Insert Error


Hello,
I'm trying to perform a simple insert statement into a table called
Parcel_Test (see code below). Yet, I get an error message that I've never
seen before (see traceback below). I've tried to put a semicolon at the end
of the sql statement, but with no luck. Any ideas from more experienced
mx.ODBC users?

CODE
>>driv='DRIVER= {Microsoft Access Driver (*.mdb)};DBQ='+ workspace
conn = odbc.DriverConn ect(driv)
crs = conn.cursor()
sql = "INSERT into Parcel_Test(NEA R_FID,NEAR_DIST ) values
('0.000000',' 0.000000') where PIN_ID = '042822120008'"
crs.execute(s ql)
TRACEBACK
Traceback (most recent call last):
File "<pyshell#1 >", line 1, in ?
crs.execute(sql )
ProgrammingErro r: ('37000', -3516, '[Microsoft][ODBC Microsoft Access
Driver] Missing semicolon (;) at end of SQL statement.', 4612)
--
View this message in context: http://www.nabble.com/Understanding-...html#a11852950
Sent from the Python - python-list mailing list archive at Nabble.com.

Jul 29 '07 #1
3 1592

"Greg Corradini" <gr***********@ gmail.comschree f in bericht
news:ma******** *************** *************** *@python.org...
>
Hello,
I'm trying to perform a simple insert statement into a table called
Parcel_Test (see code below). Yet, I get an error message that I've never
seen before (see traceback below). I've tried to put a semicolon at the
end
of the sql statement, but with no luck. Any ideas from more experienced
mx.ODBC users?

CODE
>>>driv='DRIVER ={Microsoft Access Driver (*.mdb)};DBQ='+ workspace #here a
; #!!!!!!!!!!
conn = odbc.DriverConn ect(driv)
crs = conn.cursor()
sql = "INSERT into Parcel_Test(NEA R_FID,NEAR_DIST ) values
('0.000000', '0.000000') where PIN_ID = '042822120008'"
crs.execute( sql)

TRACEBACK
Traceback (most recent call last):
File "<pyshell#1 >", line 1, in ?
crs.execute(sql )
ProgrammingErro r: ('37000', -3516, '[Microsoft][ODBC Microsoft Access
Driver] Missing semicolon (;) at end of SQL statement.', 4612)
--
View this message in context:
http://www.nabble.com/Understanding-...html#a11852950
Sent from the Python - python-list mailing list archive at Nabble.com.
Jul 29 '07 #2
On Jul 30, 2:41 am, Greg Corradini <gregcorrad...@ gmail.comwrote:
Hello,
I'm trying to perform a simple insert statement into a table called
Parcel_Test (see code below). Yet, I get an error message that I've never
seen before (see traceback below). I've tried to put a semicolon at the end
of the sql statement, but with no luck. Any ideas from more experienced
mx.ODBC users?
You tried to put a semicolon at the end of the SQL statement, but you
failed? Luck?? I would have thought it needed only steady hands and a
minimally functional text editor.
>
CODE
>driv='DRIVER={ Microsoft Access Driver (*.mdb)};DBQ='+ workspace
conn = odbc.DriverConn ect(driv)
crs = conn.cursor()
sql = "INSERT into Parcel_Test(NEA R_FID,NEAR_DIST ) values
('0.000000','0 .000000') where PIN_ID = '042822120008'"
Are you sure that that is exactly what you ran? I'm not familiar with
"pyshell", but I'd expect an error message (SyntaxError: EOL while
scanning single-quoted string) on the line that starts with "sql =".

At this stage do this to see exactly what you've got:
print repr(sql)
Maybe this pyshell gadget is trying to do statment continuation and
failing.
>crs.execute(sq l)

TRACEBACK
Traceback (most recent call last):
File "<pyshell#1 >", line 1, in ?
crs.execute(sql )
ProgrammingErro r: ('37000', -3516, '[Microsoft][ODBC Microsoft Access
Driver] Missing semicolon (;) at end of SQL statement.', 4612)
Suggestions: Type your code snippet into a text editor. Get whatever
help you need with the semicolon. Save the snippet to a .py file. Run
the .py file from your operating system's command line (not from
"pyshell"). Show us the full traceback and the contents of your .py
file. It might also help to mention what OS, what version of Python,
and what version of mxODBC.

HTH
John

Jul 29 '07 #3
On 29 Jul, 17:41, Greg Corradini <gregcorrad...@ gmail.comwrote:
Hello,
I'm trying to perform a simple insert statement into a table called
Parcel_Test (see code below). Yet, I get an error message that I've never
seen before (see traceback below). I've tried to put a semicolon at the end
of the sql statement, but with no luck. Any ideas from more experienced
mx.ODBC users?

CODE
>driv='DRIVER={ Microsoft Access Driver (*.mdb)};DBQ='+ workspace
conn = odbc.DriverConn ect(driv)
crs = conn.cursor()
sql = "INSERT into Parcel_Test(NEA R_FID,NEAR_DIST ) values
('0.000000','0 .000000') where PIN_ID = '042822120008'"
crs.execute(sq l)

TRACEBACK
Traceback (most recent call last):
File "<pyshell#1 >", line 1, in ?
crs.execute(sql )
ProgrammingErro r: ('37000', -3516, '[Microsoft][ODBC Microsoft Access
Driver] Missing semicolon (;) at end of SQL statement.', 4612)

--
View this message in context:http://www.nabble.com/Understanding-...-tf4166125.htm...
Sent from the Python - python-list mailing list archive at Nabble.com.
Apart from what John Machin has said, your SQL also looks like it's
half trying to be an insert with a subselect clause (looking at the
'where') rather than a values clause. Access might well be expecting a
semicolon after the values statement, as the where might be starting
another. Don't have mxODBC, so it's all untested - Just an idea.

Jon.

Jul 29 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1901
by: Andrew Chalk | last post by:
What is wrong with the following attempt to perform an SQL INSERT? No error is thrown but no data is inserted into table FRED in the database. Especially odd is that SELECT statements work! The database is MS SQL Server 2000. Thanks! import mx.DateTime, mx.ODBC.Windows if __name__ == '__main__':
4
1444
by: BartlebyScrivener | last post by:
Hello, I'm new to python and trying to get records from an MSAccess database using mxODBC. It works, but the output is not formatted the way I want it. Here's the script: import mx.ODBC.Windows as odbc driv='DRIVER={Microsoft Access Driver (*.mdb)};DBQ=d:/Access Databases/Quotations2005'
0
1103
by: erik.myllymaki | last post by:
I am using a script that's worked for me in the past on Windows, but now that i've moved it to a Linux machine it is not. The trouble seems to be when trying to insert escaped characters into a varchar field (\n \r ,etc.). ----------------------------------------------------------------------------- # conn = mx.ODBC.WINDOWS.DriverConnect('DSN=myDSN;UID=sa;PWD=pwd') conn = mx.ODBC.unixODBC.DriverConnect('DSN=myDSN;UID=sa;PWD=pwd')...
6
2032
by: Raphael.Benedet | last post by:
Hello, For my application, I would like to execute an SQL query like this: self.dbCursor.execute("INSERT INTO track (name, nbr, idartist, idalbum, path) VALUES ('%s', %s, %s, %s, '%s')" % (track, nbr, idartist, idalbum, path)) where the different variables are returned by the libtagedit python bindings as Unicode. Every time I execute this, I get an exception like this:
1
1435
by: Sean Davis | last post by:
I have just installed mxODBC on my x86_64 suse linux machine, where I use unixODBC for connection. Running queries from isql or DataManager works fine for the DSN that I am using. However, under mxODBC, I can get a connection object and a cursor object, but all attempts to execute even the simplest selects result in empty resultsets. Any ideas on what might be wrong? Traceback (most recent call last): File "<stdin>", line 1, in...
0
4994
bartonc
by: bartonc | last post by:
With one small change to the view/control: self.staticText3 = wx.StaticText(id=wxID_DBCONNECTDIALOGSTATICTEXT3, label='ODBC Data Source Name', name='staticText3', parent=self, pos=wx.Point(240, 40), size=wx.Size(143, 16), style=0) and some rework of the model:##from MySQLdb import * from mx.ODBC.Windows import * from time import time class DBServer: def __init__(self, master):
2
1861
by: Greg Corradini | last post by:
Hello All, A few weeks ago, I wrote two scripts using mx.ODBC on an Access DB. Among other things, both scripts create new tables, perform a query and then populate the tables with data in a dictionary that I've uploaded from elsewhere. These scripts have run hundreds of times in the last few weeks with no problems. But recently they continue to bail on the mycursor.execute('An SQL Statement') after the table has been created. I get the...
0
6901
bartonc
by: bartonc | last post by:
This is a work in progress (current and active). There are some issues to resolve in supporting multiple connection types and I plan to add PySQLite to the mix. The this update is due to my suggesting the accompanying helper functions in a recent post and noticing that the ones posted here are a bit out of date. I'll post those helpers in a separate thread. I've also been working with the following database engines: MySQL 5.x SQLite3 JET...
0
978
by: eGenix Team: M.-A. Lemburg | last post by:
On 2008-10-15 20:30, Terry Reedy wrote: It's going to look even better when we release version 4.0 in a year or so ;-) FWIW, we're still waiting for the dust to settle before going for a Py3k port of the mx C extensions. -- Marc-Andre Lemburg
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9386
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.