[Gambas-user] Problems with setting and using Connections in IDE

Gianluigi bagonergi at gmail.com
Fri Apr 24 20:03:04 CEST 2020


Il giorno ven 24 apr 2020 alle ore 18:47 T Lee Davidson <
t.lee.davidson at gmail.com> ha scritto:

> I am having difficulty using Connections defined in the IDE with
> DataSource and DataView.
>
> First, I tried a sqlite3 connection. In a new Connection dialog, I:
>
> set the Type to "SQLite",
> browsed for and set the path = "/home/user/tmp", then
> selected the DB file from the Database file chooser = "test.db".
>
> I can view the data in the db using the Connection viewer (tab). But, when
> I run the program, I get:
> "Unable to locate `test.db` in `~/tmp`".
>
> I tried with different paths and files, and it complains that it cannot
> find any of them.
>
>
> So, I tried a mysql connection. In a new Connection dialog, I:
> set the Type to "MySQL",
> set the host to "localhost" and set the user and password appropriately,
> ensured that "Remember password" was enabled,
> selected the DB from the Database chooser.
>
> The same as with the SQLite connection, I can view the data in the db
> using the Connection viewer (tab). But, when I run the
> program, I get:
> "Cannot open database: Access denied for user 'user'@'localhost' (using
> password: NO)"
>
>
> Is there something I am missing in setting up these connections?
>

I'm not sure but I believe that if the SQLite database is not inside the
project then it must be specified in the opening code like the others:

  Connections["Connection1"].Type = "sqlite3"
  Connections["Connection1"].Host = "/path/of/database"
  Connections["Connection1"].Name = "test"
  $hConn = Connections["Connection1"]

of course for MySQL it is necessary to add:

  Connections["Connection1"].Login
  Connections["Connection1"].Password
  Connections["Connection1"].Port

Regards
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200424/2bf4625e/attachment-0001.html>


More information about the User mailing list