Subject Need some help
Author mp527 <mp527@yahoo.com>
Hi, I am trying to move over from IBX, just wondering if you
guys/gals could take a look at my code.
this is running in a threaded socket server and I have the IBO
controls on a Datamodule that I create whenever I need to access the
DB. on the DM I have all IBO core components, a
session,transaction,cursor and a connection.

Everything works fine in my test environment, but at a beta test
site with 200+ users they are getting a lot of DB errors(see previos
post for error messages from the server log)

I also have the transaction set to read commited.

In the dm oncreate I do the following:
mainconnection.DatabaseName:= Server_module.dbpath;
userq.IB_Transaction:=maintrans;
mainconnection.Connect;

and in the ondestroy I do this:

try
if maintrans.InTransaction then
maintrans.Commit;
finally
mainconnection.Disconnecttopool;
end;


Then when I need to access the db in a client thread I do this:


ibdata:=tibdata.Create(nil);

with ibdata.userq do
try

ib_transaction.StartTransaction;
sql.Clear;
sql.Add('execute procedure
ADD_NEW_OFFLINE_USER(:NTUSERNAME,:MSGID)');
parambyname('MSGID').AsString:=temp;
parambyname('NTUSERNAME').AsString:=
theusername;
execsql;
IB_transaction.Commit;
clientthread.cs_writeln('OFFLINE_ADD OK');
except
on e:exception do
begin
if IB_transaction.InTransaction
then
IB_transaction.Rollback;
clientthread.cs_WriteLn
(e.message);

writeerrorlog(e.message+' (Add
to existing offline msg)');

end;
end;
finally
freeandnil(ibdata);
end;