FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How detect connection or not to MySql?
Posts: 555
Joined: Wed Jul 31, 2013 01:14 PM
How detect connection or not to MySql?
Posted: Wed Sep 16, 2020 07:32 PM

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 2501, Harbour, MVS2022 Community, MySql & MariaDB, Dbf/Cdx VSCode.

Maldonado - Uruguay
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: How detect connection or not to MySql?
Posted: Wed Sep 16, 2020 08:46 PM
Hi,

Try this:

Code (fw): Select all Collapse
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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How detect connection or not to MySql?
Posted: Wed Sep 16, 2020 09:22 PM

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
Posts: 555
Joined: Wed Jul 31, 2013 01:14 PM
Re: How detect connection or not to MySql?
Posted: Wed Sep 16, 2020 09:35 PM

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

Gracias.

Dario Fernandez

FWH 2501, Harbour, MVS2022 Community, MySql & MariaDB, Dbf/Cdx VSCode.

Maldonado - Uruguay
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How detect connection or not to MySql?
Posted: Thu Sep 17, 2020 03:32 AM

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

Continue the discussion