Subject Re: [IBO] IBO application blinks out after 10-15 days
Author jwharton@ibobjects.com
Yes, you have some problems in your code.
IBO components like to have a NON-NIL owner.
You can create a TIB_Session with a nil owner but for all other components used in the session, please go ahead and
have the TIB_Session component for them as the owner. Then, at the end, you can just free the session and everything
else goes with it.

By giving things like connection, transaction and statements a NIL owner, they auto resolve to the default session
instead of the one you have created. I also allow you to set the IB_Session property of them after they have been
created but if you do the ownership creation as I have shown all that is taken for you automatically.

Also, it is fine to keep a connection open all the time and for statements to remain prepared. Just keep in mind if you
keep a statement prepared there are various client memory structures (blobs and record buffers) that will not be freed
(even if a query is closed). By doing a periodic unprepare of your statements and datasets will keep your client memory
from being used up. This is most likely the case for any client tool set. It's just most of them automatically unprepare them
for you, however, this costs you performance I didn't want to give up. Thus, IBO requires you to be a little more
responsible about client resource usage.

HTH,
Jason Wharton

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Hi,
I am using IBO in a tcp/ip server app and after 10-15 days the
service will just blink out of existance with no errors, just gone.
I have other server apps built with Synapse and they have been
running since dec 2003 and this server is coded in the exact same
style except for the IBO usage.
I am creating the objects on the fly in the client threads
constructor, and they stay created but not always connected until
the user logs off.

I am just wondering if there is anything I am doing wrong. below is
the constructor:
Is there some settings I am missing by chance?

Constructor Tclientthread.Create
(hsock:integer;db_name,db_username,db_password:shortstring;sessionmgr
:tam_session;logthechat,usepool:boolean);
begin
sock:=TTCPBlockSocket.create;
shutingdown:=false;
Sock.socket:=hSock;
write_cs:= TCriticalSection.Create;
bcastq:= tstringlist.create;
fsessionmgr:= sessionmgr;
flogthechat:=logthechat;
fusepool:= usepool;
sock.GetSins;
FreeOnTerminate:=true;
//create database objects
admindbpath:=db_name;
db_session := TIB_Session.Create(nil);
db_connection := TIB_Connection.Create(nil);
db_connection.CacheStatementHandles:=false;
db_connection.SQLDialect:=3;
db_connection.Protocol:=cpTCP_IP;
db_connection.PageSize:=4096;
db_connection.KeepConnection:=true;

db_session.DefaultConnection := db_connection;
main_trans := TIB_Transaction.Create
(nil);
main_trans.IB_Connection := db_connection;
db_connection.DefaultTransaction := main_trans;
db_query_trans := TIB_Transaction.create
(nil);
db_query_trans.Isolation := tiCommitted;

db_query_trans.IB_Connection := db_connection;
db_query := TIB_Cursor.Create(nil);
db_query.StoredProcHasDML := true;
db_query.IB_Connection := db_connection;
db_query.IB_Transaction := db_query_trans;
db_query.IB_Session := db_session;
//set databasename
db_connection.DatabaseName:= 'localhost:'+db_name;
db_connection.Username:= db_username;
db_connection.Password:= db_password;
inherited create(false);
end;

Thanks

Tony




___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links