473,236 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,236 software developers and data experts.

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.DriverConnect(driv)
crs = conn.cursor()
sql = "INSERT into Parcel_Test(NEAR_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)
ProgrammingError: ('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 1565

"Greg Corradini" <gr***********@gmail.comschreef in bericht
news:ma***************************************@pyt hon.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.DriverConnect(driv)
crs = conn.cursor()
sql = "INSERT into Parcel_Test(NEAR_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)
ProgrammingError: ('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.DriverConnect(driv)
crs = conn.cursor()
sql = "INSERT into Parcel_Test(NEAR_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(sql)

TRACEBACK
Traceback (most recent call last):
File "<pyshell#1>", line 1, in ?
crs.execute(sql)
ProgrammingError: ('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.DriverConnect(driv)
crs = conn.cursor()
sql = "INSERT into Parcel_Test(NEAR_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)
ProgrammingError: ('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
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...
4
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...
0
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 ...
6
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')" %...
1
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...
0
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',...
2
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...
0
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...
0
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.