SQLRDD unable to connect to MYSQL server

225 views
Skip to first unread message

Jayadev

unread,
Oct 3, 2025, 9:16:23 AM (6 days ago) Oct 3
to Harbour Users
Hi,
I have been experimenting with SQLRDD but am unable to connect to local MYSQL server. I have tried with various connection strings but unable to manage connection.
/* Code Begin */
#include "sqlrdd.ch"

REQUEST SQLRDD
REQUEST SQLEX
REQUEST SR_ODBC

*--------------------------------------------------------*
FUNCTION Main()
*--------------------------------------------------------*

   LOCAL nConnection, cConString :=''
   local cIP := "127.0.0.1", cUser := "sa", cPW:= "sa",cDSN := "Vyapari", cDB := "as2425"
   Public SysErrorBlock := ErrorBlock( { |e| JdError( e ) } )
 /*
DRIVER={MySQL ODBC 8.0 Unicode Driver};Server=your_server_address;Database=your_database_name;Uid=your_username;Pwd=your_password;  
Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

 cConString :="Server=" + cIP + ";Port=6570; Uid=" + cUser + ";Pwd=" + cPW +;
 ";dsn="+cDSN+";database=" + cDB+ ";"
 
 cConString :="Server=" + cIP + ";Port=6570; User=" + cUser + ";Password=" + cPW +;
 ";DSN="+cDSN+";database=" + cDB+ ";"
 cConString :="Server=" + cIP + ";Port=6570; Usr=" + cUser + ";Pwd=" + cPW +;
 ";dsn="+cDSN+";database=" + cDB+ ";"
    cConString :="DRIVER={MySQL ODBC 8.0 Unicode Driver};dsn=Vyapari;Port=6570" */

 cConString :="DRIVER={MySQL ODBC 8.0 Unicode Driver};Server=" + cIP + ";Port=6570; Usr=" + cUser + ";Pwd=" + cPW +;
 ";dsn="+cDSN+";database=" + cDB+ ";"
   rddSetDefault( "SQLRDD" )
   nConnection := sr_AddConnection( CONNECT_ODBC, cConString)

   IF nConnection < 0
      Alert( "Connection error. See sqlerror.log for details." )
      RETURN NIL
   ELSE
      //Alert( "Connected to : " + SR_GetConnectionInfo(, SQL_DBMS_NAME ) + " " + SR_GetConnectionInfo(, SQL_DBMS_VER ) )
   ENDIF
RETURN NIL
/* code end */
Getting the following error:
[MySQL][ODBC 8.0(w) Driver]Access denied for user 'ODBC'@'localhost' (using password: YES)

Please note that the user and password are correctly given and I can see that they are well received in
the SR_CONNECTION CLASS and I have tried various connection strings as given above in comments.

What goes wrong after that, I am unable to figure out.

I am able to connect and work smoothly with "SQLMIX" RDD.

Any help will be highly appreciated.

Best,

Jayadev

marcosgambeta

unread,
Oct 6, 2025, 12:36:28 PM (3 days ago) Oct 6
to Harbour Users

Jayadev

unread,
Oct 7, 2025, 11:20:27 PM (2 days ago) Oct 7
to Harbour Users
Hi Marcos,
Thank you for your reply.

I have sent you a message on your personal email with the errors reported while compiling.  Could you please check.

Best,
Jayadev

Jayadev U

unread,
Oct 8, 2025, 7:16:55 AM (24 hours ago) Oct 8
to harbou...@googlegroups.com

Hi Marcos,

 

I have since been able to compile and run the program mysql1 and mysql2 with the following command

 

Hbmk2 mysql2 -Le:\e:\sqlrddpp\lib -llibmysql

 

I have also copied the .dll file into the test directory, the program executes stating “Connecton error, See sqlerror.log for details”.

The log file however does not show any error.

 

Best,

 

Jayadev

--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/harbour-users/b762270c-40d2-4786-88bf-9e3b1031c8aan%40googlegroups.com.

marcosgambeta

unread,
Oct 8, 2025, 9:13:07 AM (22 hours ago) Oct 8
to Harbour Users
Do you followed the instructions below ?

// Make a copy of this file and change the values below.
// NOTE: the database must exist before runnning the test.
#define SERVER "localhost"
#define UID    "root"
#define PWD    "password"
#define DTB    "dbtest"

Regards,
Marcos Gambeta

marcop...@gmail.com

unread,
Oct 8, 2025, 10:22:39 AM (20 hours ago) Oct 8
to Harbour Users
A minimal .prg to test mysql.

#include "sqlrdd.ch"
#include "mysql.ch"  

REQUEST SQLRDD
REQUEST SR_MYSQL

*************
Function Main
*************
RddSetDefault('SQLRDD')

srvConecta()

xQuery := "select * from clientes"

use (xQuery) alias teste
dbedit()

clear
close all
return

*******************
function srvConecta
*******************
Local tmpSTR
tmpSTR := "mysql=192.168.10.10;uid=admin;dtb=teste;pwd=Vy@123456"

// Conectando ao BD
wConexao := Sr_AddConnection( CONNECT_MYSQL , tmpSTR)
return wConexao > 0

Osvaldo Ramirez

unread,
Oct 8, 2025, 10:38:25 AM (20 hours ago) Oct 8
to harbou...@googlegroups.com

Marco, buen dia.

Podras compartir las archivos .LIB que usas para postgresql y mariaDB ?

Saludos y gracias de antemano

--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.

Jayadev U

unread,
Oct 8, 2025, 11:11:54 AM (20 hours ago) Oct 8
to harbou...@googlegroups.com

Hi Marcos,

 

I have been able to successfully run the mysql1 program.  Sorry for all the noise, the problem was that port used by connection string was default whereas I had a opened a different port for MySQL. So native connection using MYSQL works correctly.

 

Now, we need to address the ODBC issue.

 

Best,

 

Jayadev

 

 

From: Jayadev U <ujay...@gmail.com>
Sent: 08 October 2025 04:47 PM
To: 'harbou...@googlegroups.com' <harbou...@googlegroups.com>
Subject: RE: [harbour-users] Re: SQLRDD unable to connect to MYSQL server

 

Hi Marcos,

 

I have since been able to compile and run the program mysql1 and mysql2 with the following command

 

Hbmk2 mysql2 -Le:\e:\sqlrddpp\lib -llibmysql

 

I have also copied the .dll file into the test directory, the program executes stating “Connecton error, See sqlerror.log for details”.

The log file however does not show any error.

 

Best,

 

Jayadev

 

 

 

 

 

From: harbou...@googlegroups.com <harbou...@googlegroups.com> On Behalf Of Jayadev
Sent: 08 October 2025 08:50 AM
To: Harbour Users <harbou...@googlegroups.com>
Subject: [harbour-users] Re: SQLRDD unable to connect to MYSQL server

 

Hi Marcos,

--

You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages