[Gambas-user] Database connection problem
Biro Zoltan
office.zolano at ...626...
Sat Oct 16 19:07:23 CEST 2010
Hi!
I'm trying to write a small code using a database on a server (small
home network).
On the server machine I have installed: Ubuntu 10.10, Apache2,
Mysql-server version 5.1.49. Here in my.cnf I deleted the row containing
"bind-address=127.0.0.1". This machine have the local IP address:
192.168.1.111 The name of the machine: Ubiserver. I created here a
database named: Zolano
On the user machine I have: Ubuntu 9.10, Apache2, Mysql-server 5.1.37
and Mysql-client ...and Gambas2 version 2.21.0 This machine have IP
address 192.168.1.11 Here also made the same change in my.cnf The name
of the machine: Ubuntuone
In Gambas2 on "Ubuntuone" I made the connection in following way:
PUBLIC FUNCTION connect(host AS String, lgn AS String, pass AS String,
baza AS String) AS Boolean
$db.close
$db.Type = "mysql"
$db.Host = host
$db.Login = lgn
$db.Password = pass
$db.Name = baza
$db.Port = "3306"
$db.Open
RETURN TRUE
CATCH
Message.error(Error.text)
RETURN FALSE
END
PUBLIC SUB FORM_OPEN()
IF connect("192.168.1.111", "root", "admin", "zolano") = TRUE
.....
ELSE
ME.Close
ENDIF
END
This code return an error: "Can't open database. Host 'Ubuntuone.local'
is not allowed to connect to this MySQL server."
If I use "localhost" instead of "192.168.1.111" is everything allright,
and the tables is saved on my local machine.
BUT I have to use the database created on server.
I am sure that is not a Gambas2 problem, but I would be happy if
somebody can guide me, where is the mistake..
Thank you.
Best regards,
Zoli B.
More information about the User
mailing list