Share Mysql connection to different Unit lazarus / 13-General ---------------------------------------------------------------------- panjas51 · 2008-02-23 22:48 Hello; I'm developping an appli connected to Mysql5.0 On the first unit, I use Code: [Select]interface type MySQL50Connection1: TMySQL50Connection;                      // CONNECTION TO THE MYSQL50 SQLTransaction1: TSQLTransaction;       This HAS to be under be under TYPE... I would like to share this connection to "child units" To do So I've tried to place them onto the Global variable Code: [Select]interface var But this doesn't work. I feel like understanding that this "Connection" and "Transaction" are not variable???? Am I wrong? How can I share this connection. Otherwise, I'll have to close and open for each unit.... That would loose some reactivity time. Thanks ---------------------------------------------------------------------- piper62 · 2008-02-27 19:56 Hi, we are working with ZeosLib but I think it will work with the other components too. In a multi form application we have one unit/form wich holds the ZConnetion object. This is loaded at first. All other units have no ZConnection object, they only have their ZQuery objects. When a form is created you can do after create the connection between the ZQuery and the ZConnection like ZQuery1.Connection:=form_db_connection.ZConnection1; This works very good and the benefit is that you can exchange more easily the database or the properties for the connection. The drawback is that you can't work multithreaded, if you would like to do that you need one connection for each thread. In our case we don't need it so we stay with the central connection. Regards, Tibor