[Gambas-user] Database connection with gb.db.form method

Jorge Carrión shordi at gmail.com
Tue Jul 16 20:11:43 CEST 2019


Well, I've done some tests and I think I can confirm that the connection
can not be established graphically if the database is in the project
folder. Outside the project folder (or in a subfolder inside it) works
perfectly.
Either way the subject does not make much sense. If you compile the
connection path in the installation package, the program will only work on
the computer where it was designed unless you use a system folder, which is
not recommended, I think. If you could set the .host property at
Application.path then it would only work as readonly what is useless.
What I do is create the "Application.Path/data" folder and locate the
database in it. When creating the installation package, that database is
compiled in the ejecutable and in the first execution is created normally
in Desktop.datadir &/ Application.Name/ folder
In the following executions of the project, the .host of the connection to
this path is established.
A couple of days ago I uploaded a project to the Gambas Farm called
gbcalendario (I did not have time to translate it, I'm sorry) that uses
that technique.

Hope it helps for you.

Best Regards

El mar., 16 jul. 2019 a las 19:23, Gianluigi (<bagonergi at gmail.com>)
escribió:

> Hi Jorge,
> I badly explained myself.
> You mean that if the database is called MyDatabase, the program is called
> MyProject and is in the home folder you can't connect if MyDatabase is
> directly inside MyProject (home/<my user name>/MyProject/MyDatabase).
> If you add a folder for example MyFolder then it works (home/<my user
> name>/MyProject/MyFolder/MyDatabase).
>
> The same happens here.
>
> I, on the other hand, would like to understand how to make the connection
> created with the graphic system of the gb.db.form component work, with
> MyFolder/MyDatabase located outside MyProject.
> How can the connection work only if the database is in the project (even
> if in another folder)?
> There must be a way to compile the project without compromising its
> operation.
> What is it that my old brain can't understand?
>
> Regards
> Gianluigi
>
> Il giorno mar 16 lug 2019 alle ore 18:28 Jorge Carrión <shordi at gmail.com>
> ha scritto:
>
>> No, just the opposite: I can't connect in the application.path. Creating
>> a new directory inside the application.path it'worked... but I didn't try
>> further things...
>> I don't dare to isolate the bug (if its a bug).
>>
>> Regards.
>>
>> El mar., 16 jul. 2019 a las 13:36, Gianluigi (<bagonergi at gmail.com>)
>> escribió:
>>
>>> Hi Jorge,
>>> thank you very much for the reply.
>>> So are you telling me that it is impossible to connect graphically to a
>>> database located outside the application?
>>> The wiki on this topic is ambiguous...
>>>
>>> Regards
>>> Gianluigi
>>>
>>> Il giorno mar 16 lug 2019 alle ore 12:19 Jorge Carrión <shordi at gmail.com>
>>> ha scritto:
>>>
>>>> I had a similar issue a few days ago but in my case the .host of the
>>>> connection was the /home/user/gambasprojects/project what is the
>>>> application.path. I created a folder inside
>>>> (/home/user/gambasprojects/project/Datos) and all works fine then.
>>>> I thought it was a exected behaviour...
>>>>
>>>> Regards
>>>>
>>>>
>>>> El mar., 16 jul. 2019 a las 11:11, Gianluigi (<bagonergi at gmail.com>)
>>>> escribió:
>>>>
>>>>> Hi Hans,
>>>>> thanks for the help but unfortunately I always get error:
>>>>> See attached image.
>>>>> I tried to connect to your test database, these are my passages.
>>>>>
>>>>> FMain properties:
>>>>> Arrangement = Vertical
>>>>>
>>>>> DataSource1 properties:
>>>>> Arrangement = Vertical
>>>>> Connection = Connection1
>>>>> Expand = True
>>>>> Table = mausi
>>>>>
>>>>> DataBrowser1 properties:
>>>>> Columns id (table with one column)
>>>>> Editable = True
>>>>> Expand = True
>>>>>
>>>>> FMain.class code:
>>>>> Public Sub Form_Open()
>>>>>   Connections["Connection1"].Open
>>>>> End
>>>>>
>>>>> Public Sub Form_Close()
>>>>>   Connections["Connection1"].Close
>>>>> End
>>>>>
>>>>> Components:
>>>>> gb
>>>>> gb.db
>>>>> gb.db.form
>>>>> gb.form
>>>>> gb.gui (or gb.gui.qt)
>>>>> gb.image
>>>>> I try also with adding gb.db.sqlite3
>>>>>
>>>>> Regards
>>>>> Gianluigi
>>>>>
>>>>> Il giorno lun 15 lug 2019 alle ore 23:37 Gianluigi <
>>>>> bagonergi at gmail.com> ha scritto:
>>>>>
>>>>>> Hi,
>>>>>> I can't get the connection through only the graphic of the gb.db.form
>>>>>> component.
>>>>>> See attached project.
>>>>>>
>>>>>> In a Balloon on Debug Common.CheckDB.34 I get:
>>>>>> Unable to locate database 'test' in '~/database'
>>>>>>
>>>>>> Am I wrong with the settings or is it a bug?
>>>>>>
>>>>>> Regards
>>>>>> Gianluigi
>>>>>>
>>>>>
>>>>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net
>>>>> ]----
>>>>>
>>>>
>>>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net
>>>> ]----
>>>>
>>>
>>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>>>
>>
>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>>
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190716/8f33c0f9/attachment-0001.html>


More information about the User mailing list