How detect connection or not to MySql?

How detect connection or not to MySql?

Postby D.Fernandez » Wed Sep 16, 2020 7: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 24.09, Harbour, MVS2022 Community, BCC, MySql & MariaDB, Dbf/Cdx VSCode.
Maldonado - Uruguay
D.Fernandez
 
Posts: 471
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay

Re: How detect connection or not to MySql?

Postby vilian » Wed Sep 16, 2020 8:46 pm

Hi,

Try this:

Code: Select all  Expand view  RUN

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
vilian
 
Posts: 978
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: How detect connection or not to MySql?

Postby nageswaragunupudi » Wed Sep 16, 2020 9: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
User avatar
nageswaragunupudi
 
Posts: 10648
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How detect connection or not to MySql?

Postby D.Fernandez » Wed Sep 16, 2020 9:35 pm

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

Gracias.
Dario Fernandez
FWH 24.09, Harbour, MVS2022 Community, BCC, MySql & MariaDB, Dbf/Cdx VSCode.
Maldonado - Uruguay
D.Fernandez
 
Posts: 471
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay

Re: How detect connection or not to MySql?

Postby nageswaragunupudi » Thu Sep 17, 2020 3: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
User avatar
nageswaragunupudi
 
Posts: 10648
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 54 guests