[Gambas-user] Slow Mysql connection

Benoit Minisini gambas at ...1...
Thu Aug 24 17:51:24 CEST 2006


On Thursday 24 August 2006 17:04, juanramon at ...1546... wrote:
> Ok Benoit,
>
> 1.-I connect to an external database via Internet. Is a Public Function in
> Modul :
>
>   PUBLIC FUNCTION ConectarBase() AS Boolean
>
>    IF MComun.Conectar <> NULL THEN RETURN FALSE
>
>    MComun.Conectar = NEW Connection
>    WITH MComun.Conectar
>     .Host = "XX.XX.XXX.XXX" .-Static IP
>     .Name = "instore"
>     .Type = "mysql"
>     .Login = "XXX"
>     .Password = "XXXX"
>    END WITH
>
>    TRY MComun.Conectar.Open()
>    IF ERROR THEN
>     MComun.Conectar = NULL
>     Message.Error("ERROR AL CONECTAR CON LA BASE DE DATOS")
>     RETURN TRUE
>    END IF
>
>    RETURN FALSE
>
>  END
>
> 2.- I verify connection problems to enter de Database in FormMain:
>
>   PUBLIC SUB Form_Open()
>
>    ME.Center()
>
>    IF MComun.ConectarBase() THEN
>       Message.Info("NO S'HA POGUT FER LA CONNEXIO")
>       RETURN
>    END IF
>
>   END
>
> 3.- Open Forms selecting in the Menu:
>
>   PUBLIC SUB Caixeres_Click()
>
>    DIM Caixeres AS FormCaixeres
>
>    Caixeres = NEW FormCaixeres(ME)
>    Caixeres.Show()
>
>   END
>
>   One function for each option of the menu that opens a new form
>
> Each form consists of a diferent DataSource connected to diferents tables
> of the DataBase and many “DataControls”
>
> When I open a form for the first time goes very slow,  when opening for
> the second time it's a normal function.
>
> Thanks,
>

The Data* controls must download the parts of the database model they need to 
do their job, and so it is slow. But it is slow only the first time, as the 
data is cached.

Regards,

-- 
Benoit Minisini





More information about the User mailing list