firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -
i'm developing update app delphi 10. i'm running windows 7 64x, firebird 2.5.1.26351 32x.
execution order:
- checks current version(select statement firebird database)
- downloads update(via ftp)
- apply it(.exe files, , execute .sql)
error code -901 pops out when try execute .sql files. know there incompatibility issue w7 64x , fdb 32x, but, can everything: backup , restore(gbak), db commands(all). tried fdb 64x instead, , not working.
code:
//components fdwaitcursor: tfdguixwaitcursor; fddriverlink: tfdphysfbdriverlink; fdconnection:tfdconnection; fdscript: tfdscript; function tthr_script.createcomponents:boolean; begin try fddriverlink := tfdphysfbdriverlink.create(fddriverlink); fdwaitcursor := tfdguixwaitcursor.create(fdwaitcursor); fdconnection := tfdconnection.create(fdconnection); fdconnection begin drivername := 'fb'; params.username := thrbanco.bduser; params.password := thrbanco.bdpass; params.database := thrbanco.dirorigem; end; fdscript := tfdscript.create(fdscript); fdscript begin connection := fdconnection; onconsoleput := fdscript_consoleput; end; result := true; except on e:exception begin result := false; end; end; end; procedure tthr_script.execlogs; var f : integer; sr : tsearchrec; begin f := findfirst(extractfilepath(application.exename)+'\manager\update\logs\*.sql',faarchive,sr); fdconnection.open; while f = 0 begin fdscript begin sqlscripts.clear; sqlscriptfilename := extractfilepath(application.exename)+'\manager\update\logs\'+sr.name; validateall; executeall; end; application.processmessages; f := findnext(sr); end; fdconnection.close; end;
after installing firebird 2.5.6, still got same -901 error. error log:
update empresa set emp_verbanco='2016.55'; [13_09_2016 | 14:29]: ok [00:00:00.047]. [13_09_2016 | 14:29]: update empresa set emp_versis='2016.55'; [13_09_2016 | 14:29]: ok [00:00:00.016]. [13_09_2016 | 14:29]: commit work; [13_09_2016 | 14:29]: error: dynamic sql error sql error code = -901 invalid transaction handle (expecting explicit transaction start)
the error indicates having things 'commit work;' in sql script.
as per firedac documentation:
resolving incompatibilities
firebird isql works in non-autocommit mode. default, autocommit mode tfdscript/tfdconnection turned on. better compatibility, set fdconnection.txoptions.autocommit false before script execution. or execute set autocommit off script command.
http://docwiki.embarcadero.com/radstudio/berlin/en/executing_sql_scripts_(firedac)
Comments
Post a Comment