By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,199 Members | 1,120 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,199 IT Pros & Developers. It's quick & easy.

Understanding mxODBC Insert Error

P: n/a

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
Share this Question
Share on Google+
3 Replies


P: n/a

"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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.