Does anyone know why I might be receiving the following error when commit; is executed in embedded SQL in WebServer?
The code connects to the database and retrieves data properly.
Primary Code
transaction l_trans
if -1 = this.trigger event ue_connect(l_trans) then return -1
dw_1.SetTransObject(l_trans)
dw_1.retrieve()
commit;
destroy l_trans
Event: ue_connect
string ls_error
string ls_datasource = 'test_postgres'
a_trans = create transaction
a_trans.AutoCommit = false
a_trans.DBMS = 'odb-pgs'
a_trans.DBParm = "CacheName='" + ls_datasource + "'"
// connect to db
CONNECT USING a_trans;
// --- Check for errors in database connection
if a_trans.SQLCode = 0 then
return 0
else
ls_error = 'Unable to connect to database:' + &
'~r~n' + '~r~n' + 'DBMS: ' + a_trans.dbms + &
'~r~n' + 'DBParm(DataSource): ' + a_trans.DBParm + &
'~r~n' + '~r~n' + 'Error Code: ' + string (a_trans.SQLDBCode) + &
'~r~n' + 'Error Message: ' + a_trans.SQLErrText
MessageBox('ue_connect', ls_error)
return -1
end if
Full Error Message:
Error 20010
Transaction is not connected.
For more help, please consult the Appeon user document.
My personal coding style is to ALWAYS be explicit on "USING …;" even when it is "USING SQLCA;"
I don't want to shoot myself in the foot once more by A) modify data, B) check SQLCode, and C) COMMIT/ROLLBACK on different DB connections.