Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 29th, 2007, 05:45 PM
Greg Corradini
Guest
 
Posts: n/a
Default 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
Quote:
Quote:
Quote:
>>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.

  #2  
Old July 29th, 2007, 07:15 PM
Harrie Geerts
Guest
 
Posts: n/a
Default Re: Understanding mxODBC Insert Error


"Greg Corradini" <gregcorradini@gmail.comschreef in bericht
news:mailman.1310.1185727301.22759.python-list@python.org...
Quote:
>
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
Quote:
Quote:
>>>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.
>
  #3  
Old July 29th, 2007, 10:45 PM
John Machin
Guest
 
Posts: n/a
Default Re: Understanding mxODBC Insert Error

On Jul 30, 2:41 am, Greg Corradini <gregcorrad...@gmail.comwrote:
Quote:
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.
Quote:
>
CODE
>
Quote:
Quote:
>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.
Quote:
Quote:
Quote:
>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

  #4  
Old July 29th, 2007, 11:15 PM
Jon Clements
Guest
 
Posts: n/a
Default Re: Understanding mxODBC Insert Error

On 29 Jul, 17:41, Greg Corradini <gregcorrad...@gmail.comwrote:
Quote:
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
>
Quote:
Quote:
>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.

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles