Page 1 of 1

How detect connection or not to MySql?

Posted: Wed Sep 16, 2020 7:32 pm
by D.Fernandez
Hello,
I try to detect de connection with this..
FWCONNECT oCn HOST "localhost" USER "dario" PASSWORD "123456" DB "casa2"
// But the error is shown after the If sentenece.
if oCn == nil
Msginfo("Sin conexión)"
endif

Gracias.

Re: How detect connection or not to MySql?

Posted: Wed Sep 16, 2020 8:46 pm
by vilian
Hi,

Try this:

Code: Select all

if oCn == nil
         Msginfo("Sin conexión)"
elseif oCn:nError <> 0
          Msginfo("Error: "+oCn:cError)
endif
 

Re: How detect connection or not to MySql?

Posted: Wed Sep 16, 2020 9:22 pm
by nageswaragunupudi
In case the connection fails, the connection error number and description are displayed and oCn is returned with nil value.

Re: How detect connection or not to MySql?

Posted: Wed Sep 16, 2020 9:35 pm
by D.Fernandez
Lamentablemente no funciona.
El error es
2003
Can't connect to Mysql server on 'localhost' (10061)

Gracias.

Re: How detect connection or not to MySql?

Posted: Thu Sep 17, 2020 3:32 am
by nageswaragunupudi
10061: Could not connect to "localhost" with the credentials.

Make sure MySQL server service is running on your PC.
Also try "127.0. 0.1" instead of "localhost"
Check your installation, user privileges, etc.
First, try with MySQL workbench to connect.