SQLMIX Query error with MySql 8.0.15 (Community)

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
jayadevu
Posts: 238
Joined: Tue May 19, 2009 7:10 am

SQLMIX Query error with MySql 8.0.15 (Community)

Post by jayadevu »

Hi All,

The following Query works flawlessly with MySql Version 5.7.20 (Community) but gives out blank entries (that is, it shows blank entries in DB and Table columns though shows no of records correctly) with Version 8.0.15 (Community), Hope someone can throw some light on the same.

Using Harbour 3.2+SqlMix
hbmk2 ShowDb Sddodbc.hbc -run


Code: Select all

/*Code */
#include "dbinfo.ch"
request SQLMIX , SDDODBC

Function Main
    local cQuery := "", nConnectionInfo := 0
    local cIP := '127.0.0.1',cUser := 'sa', cPw := 'sa',xRootDB  := 'Vyapari', cDB := 'as1819'
    setmode(25,80)
    RDDSETDEFAULT( "SQLMIX" )
    nConnectionInfo := rddInfo( RDDI_CONNECT, { "ODBC", "Server="+cIP+";Driver={MySQL ODBC 5.3 Unicode Driver};dsn=Vyapari;User="+cUser+";Password="+cPw+";database="+xRootDb+";" })
    IF nConnectionInfo == 0
       hb_alert("Unable connect to the server!"+Chr(13)+Chr(10)+Str(RDDINFO( RDDI_ERRORNO ))+Chr(13)+Chr(10)+RDDINFO( RDDI_ERROR ))
       Return nConnectionInfo := 1 // 0 in nLogin means Mediator is sucessfully logged
    ENDIF
    cQuery := "SELECT table_schema as 'Db',table_name as 'Dbf' FROM information_schema.tables " +;
             "where table_schema NOT RLIKE('SCHEMA|MYSQL|SYS|WORLD|SAKILA') order by Upper(Table_schema),Upper(table_name)"

    /*cQuery := "SELECT table_schema,table_name FROM information_schema.tables "+;
              "where table_schema LIKE('%"+cDB+"%')" */
    DBUseArea(.t.,"SQLMIX",cQuery,"ShowDB",.t.,.t.)
    browse()
    dbcloseall()
return NIL   
 /*End of Code*/   
Please note that the query executes correctly on MySql WorkBench for both the versions for the same login.

I had posted this query in Harbour Newsgroup also but did not receive any response.

Warm regards,

Jayadev
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: SQLMIX Query error with MySql 8.0.15 (Community)

Post by serge_girard »

No idea about this.
I just use 'plain' MySQL for years without any problem!
Perhaps Dragan or Rathi knows?

Serge
There's nothing you can do that can't be done...
User avatar
Anand
Posts: 595
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF

Re: SQLMIX Query error with MySql 8.0.15 (Community)

Post by Anand »

Hi Jayadev,

You are using 'Driver={MySQL ODBC 5.3 Unicode Driver}' with MySql Version 8.0.15 (Community).
Try making drive with Version 8.0.15 (Community) and use it.
Also check if Version 8.0.15 (Community) is Unicode or Ansi.

Regards,

Anand
Regards,

Anand

Image
jayadevu
Posts: 238
Joined: Tue May 19, 2009 7:10 am

Re: SQLMIX Query error with MySql 8.0.15 (Community)

Post by jayadevu »

Thanks a ton Anand,

Using the wrong Driver was the problem (It should have been 8.0.15 instead of 5.3). Yes, all MySql installations are unicode.

Warm regards,

Jayadev
User avatar
jairpinho
Posts: 420
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Contact:

Re: SQLMIX Query error with MySql 8.0.15 (Community)

Post by jairpinho »

serge_girard wrote: Sat Feb 23, 2019 8:09 am No idea about this.
I just use 'plain' MySQL for years without any problem!
Perhaps Dragan or Rathi knows?

Serge
Hello Serge, you use this way without libmysql.dll
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: SQLMIX Query error with MySql 8.0.15 (Community)

Post by serge_girard »

Jair,

libmysql.dll is necessary !

You can use this small prg to install it.

Code: Select all

#Include <hmg.ch>

Function Main()
LOCAL cFileRes := ResToFile("README")

MsgInfo(cFileRes)

cFileRes := ResToFile("libmysql")

IF !FILE('libmysql.dll')
	STRFILE(HMG_LoadResourceRawFile ( 'libmysql', RT_RCDATA ),'libmysql.dll')
ENDIF

// https://harbour.github.io/doc/clct3.html#strfile
Return Nil






#pragma BEGINDUMP
#include <Windows.h>
#include <hbApi.h>

HB_FUNC( RESTOFILE )
{
 static HRSRC hr;
 static HGLOBAL hg;

 hr = FindResource( NULL, (LPSTR) hb_parc( 1 ), RT_RCDATA );
 if( ! ( hr == 0 ) )
   {
    hg = LoadResource( NULL, hr );
    if( ! ( hg == 0 ) )
      {
       char *lpRcData=( char *)LockResource( hg );
       hb_retc( lpRcData );
      }
   }
}

#pragma ENDDUMP
Of course the program will need the dll file so put it in the same folder as the EXE.

Serge
There's nothing you can do that can't be done...
Post Reply