python - UPDATE statement on Access database fails silently under pyodbc -
i have problem simple update statement. wrote python tool creates lot of update statements , after creating them want execute them on access database doesn't work 1 statement example:
update fcl_b_coversheet_a set branch = 0 obj_id = '1220140910132011062005';
the statement syntax not problem. tested , works.
this next code snippet shows initialization connect object.
strinputpathmdb = "c:\\test.mdb" drv = '{microsoft access driver (*.mdb)}'; con = pyodbc.connect('driver={0};dbq={1};uid={2};pwd={3};'.format(drv,strinputpathmdb,"administrator",""))
after wrote method execute 1 sql statement
def executesqlstatement(conconnection, strsql): arcpy.addmessage(strsql) cursor = conconnection.cursor() cursor.execute(strsql) conconnection.commit()
and if execute code seems work - no error message or - data not updated , don't know i'm doing wrong ...
for strsql in sqlstatearray: executesqlstatement(con, strsql) con.close()
i hope understand problem is. help.
chris
the issue here .mdb file in root folder of c: drive. root folders restrict normal users read-only access database file being opened read-only. moving .mdb file public folder solved problem.
Comments
Post a Comment