How detect connection or not to MySql?

Post Reply
D.Fernandez
Posts: 392
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay
Contact:

How detect connection or not to MySql?

Post 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.
Dario Fernandez
FWH, Harbour, BCC, MySql & MariaDB, tData, Dbf/Cdx
VSCode.
Maldonado - Uruguay
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: How detect connection or not to MySql?

Post by vilian »

Hi,

Try this:

Code: Select all

if oCn == nil
         Msginfo("Sin conexión)"
elseif oCn:nError <> 0
          Msginfo("Error: "+oCn:cError)
endif
 
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: How detect connection or not to MySql?

Post by nageswaragunupudi »

In case the connection fails, the connection error number and description are displayed and oCn is returned with nil value.
Regards

G. N. Rao.
Hyderabad, India
D.Fernandez
Posts: 392
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay
Contact:

Re: How detect connection or not to MySql?

Post by D.Fernandez »

Lamentablemente no funciona.
El error es
2003
Can't connect to Mysql server on 'localhost' (10061)

Gracias.
Dario Fernandez
FWH, Harbour, BCC, MySql & MariaDB, tData, Dbf/Cdx
VSCode.
Maldonado - Uruguay
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: How detect connection or not to MySql?

Post 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.
Regards

G. N. Rao.
Hyderabad, India
Post Reply