Lazarus

Programming => Databases => Topic started by: CarlLanco on April 16, 2021, 09:51:13 pm

Title: Error in MySQL connectiom
Post by: CarlLanco on April 16, 2021, 09:51:13 pm
I tried to connect a program with a data base in a external server.
When i test the connection in the objet inspector, it work fine (after several days of work), but when I run the program, the connecction fail and this message pop-up.:"DBConnecction : Server connection failed .".

 I use w10 64 bits
What can be wrong??
Title: Re: Error in MySQL connectiom
Post by: Ñuño_Martínez on April 18, 2021, 12:06:03 pm
Without a sample code it is hard to know...
Title: Re: Error in MySQL connectiom
Post by: Zvoni on April 19, 2021, 08:41:34 am
Well, the first two "classic" suspects are
1) The BindAddress-Parameter in the my.cnf/my.ini causing the server to listen to localhost only
2) the used "user" not being allowed external access a.k.a 'bob'@'localhost' instead 'bob'@'%'
Title: Re: Error in MySQL connectiom
Post by: dseligo on April 19, 2021, 10:41:52 am
I assume you run program from same computer you are able to connect from Object inspector?
Do you have any code in your program that changes properties of DBConnection? Or you just set 'DBConnection.Connected:=True;' in your program?
Try to disable firewall temporarily and see if that helps.
Title: Re: Error in MySQL connectiom
Post by: dseligo on April 19, 2021, 10:45:43 am
Well, the first two "classic" suspects are
1) The BindAddress-Parameter in the my.cnf/my.ini causing the server to listen to localhost only
2) the used "user" not being allowed external access a.k.a 'bob'@'localhost' instead 'bob'@'%'
If he can connect from OI on the same computer then 1) is not the case. And he said he connects to remote computer, so this one should be OK.
Same goes for 2), and I think he would get another error (something like 'user bob is not allowed...').
Title: Re: Error in MySQL connectiom
Post by: Zvoni on April 19, 2021, 11:08:44 am
He has not specified, if the dev_MySQL-Server is the same as the one he tries to run the program against.

Think about it: when you're developing a frontend for a MySQL-Database, do you really have a dedicated machine somewhere?

OH, and there is a reason why i never set the connection-properties in the OI.....
Title: Re: Error in MySQL connectiom
Post by: dseligo on April 19, 2021, 11:33:55 am
He has not specified, if the dev_MySQL-Server is the same as the one he tries to run the program against.

Think about it: when you're developing a frontend for a MySQL-Database, do you really have a dedicated machine somewhere?

OH, and there is a reason why i never set the connection-properties in the OI.....
That's the reason I asked him: 'Do you have any code in your program that changes properties of DBConnection?'
TinyPortal © 2005-2018