Python pyodbc connected to two db Exit code: 3221225477

  criteria, odbc, pyodbc, python

The following script connects to two databases, when it executes the update statement, the script crashes with> Exit code: 3221225477

#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
import sys
reload(sys)
sys.setdefaultencoding('iso-8859-1')

import pyodbc
print("pyodbc " + pyodbc.version)
import locale
locale.setlocale(locale.LC_ALL, '')
import datetime


database = "W:ARCHIVIELISA.DBD"                                               #first Database
user = "user"
password = "password"

connessione = 'DRIVER={Prologue CRITERIA driver 32bit};DBQ=' + database + ';UID=' + user + ';PWD=' + password
cnxn1 = pyodbc.connect(connessione,autocommit=True,CHARSET=8859-15)

cursor = cnxn1.cursor()
cursor.execute ('SELECT * FROM FILEUTE WHERE ute_key = ?',['NEREO   '])
print cursor.fetchall()                                                         #this works
cursor.close()
#
#
#
database = "W:ARCHIVIAZ777AZ777.DBD"                                         #second database
user = "user"
password = "password"
connessione = 'DRIVER={Prologue CRITERIA driver 32bit};DBQ=' + database + ';UID=' + user + ';PWD=' + password
cnxn = pyodbc.connect(connessione,autocommit=True,CHARSET=8859-15)

cursor1 = cnxn.cursor()
cursor1.execute ("select * from TAZ777")
print cursor1.fetchall()                                                        #this works
cursor1.close()



update = "UPDATE TAZ777 SET taz_data_test = ? ,taz_data_gg = ? ,taz_data_aa = ? ,taz_data_mm = ? ,taz_cod = ?  WHERE taz_key = ?"
values = [datetime.date(2021, 6, 15), '15', '21', '06', 1, 1]
cursor1 = cnxn.cursor()

cursor1.execute (update,values)                                                 #this is interrupted with error >Exit code: 3221225477

cursor1.close()

use:

  • Python 2.7.18
  • Pyodbc 4.0.30
  • Windows 10 connected to Windows Server 2019

The same script works fine, with Windows XP connected to Windows Server 2003

The trace of the odbc driver is regular

Any suggestions ?

Thanks in advance

Source: Python Questions

LEAVE A COMMENT