FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Porting FW to FWH using MySql
Posts: 38
Joined: Tue Sep 30, 2008 11:16 AM
Porting FW to FWH using MySql
Posted: Thu Feb 04, 2010 10:28 AM

Hi all,
I'm porting my applications from FW to FWH .

I use MySql , and in FW I used class TDbOdbc in this way :
oDbf := TDbOdbc():new("SELECT * FROM mytab....... " , oOdbc)
and then I scan ODbf structure to retrieve data .

I use this method also in FWH and it work fine: why Antonio says that Tdbodbc is only for 16 bits ?
Is there any warning ?

best regards

wzaf

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Porting FW to FWH using MySql
Posted: Sun Feb 07, 2010 08:30 AM

Wzaf,

You can also use Class TDbODBC in 32 bits if you need it :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 38
Joined: Tue Sep 30, 2008 11:16 AM
Re: Porting FW to FWH using MySql
Posted: Sun Feb 07, 2010 06:29 PM

Thank you for your answer, Antonio ,

Anyway i started to port my programs to ADO and Adordd (with some difficulties) .
I use ADODB.connection and ADODB.recordset object, but I'm not able to find documentation: Do you know where I can find it ?

Best regards
Wzaf.

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Porting FW to FWH using MySql
Posted: Mon Feb 08, 2010 04:11 AM
Dear Mr.Wzaf,

I'm not able to find documentation: Do you know where I can find it ?

http://www.w3schools.com/ado/default.asp

Regards
Anser
Posts: 38
Joined: Tue Sep 30, 2008 11:16 AM
Re: Porting FW to FWH using MySql
Posted: Mon Feb 08, 2010 12:31 PM

Tank you Anser,
a very good site.

I still have a difficulty to handle the errors on a 'connection:execute' command :
Do you know how to catch the returned errors ?

Tank you

Regards

Wzaf

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 06:56 AM
Dear Mr.Wzaf,

Code (fw): Select all Collapse
Local oError
TRY
   oCmd:Execute()
CATCH oError
     MsgInfo( " Error No:  "+AllTrim(STR(oError:NativeError))+CRLF+;
          " Description :  "+oError:Description)
END


Regards
Anser
Posts: 38
Joined: Tue Sep 30, 2008 11:16 AM
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 08:34 AM
Dear Anser,

Thank you , but I already tried this method and I get : "No exported method: NATIVEERROR" ,
instead the "oError:description" works fine.

Best regards
Wzaf
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 09:20 AM

Dear Mr.Wzaf,

I hope that u r using ADO. Can u please provide the following info.

MySQL Ver
ODBC Driver ver
Your connection string

Regards
Anser

Posts: 38
Joined: Tue Sep 30, 2008 11:16 AM
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 09:46 AM

Dear Anser

Here they are :

mysql: 5.0.67
odbc: mysql ODBC 5.1 driver : 5.01.06.00
cConnectString := "Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=mydb; User=myuser;Password=mypassw;Option=3"

best regards

Wzaf

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 09:55 AM
Are you able to connect to the database ?. If not please try the following con. string
Try the following connection string
Code (fw): Select all Collapse
"Driver={MySQL ODBC 5.1 Driver};Server=192.168.0.170;Port=3306;Database=YourDbName;User=YourUserName;Password=YourPassword;Option=3;"


Regards
Anser
Posts: 38
Joined: Tue Sep 30, 2008 11:16 AM
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 10:11 AM

Anser ,

All works fine : I connect successfully : I correctly do SELECT and UPDATE in database.
I'm not able to correctly view the ADO errors (if there are...)

Regards
Wzaf

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 10:27 AM
Dear Mr.Wzaf,

Code (fw): Select all Collapse
*---------------------------------------------------*
Function ShowSqlError(oError)
*---------------------------------------------------*
FOR EACH oError IN oApp:oConnection:Errors
   MsgInfo( " Error No:  "+AllTrim(STR(oError:NativeError))+CRLF+;
          " Descripcion :  "+oError:Description, oApp:cAppName)
   oApp:nLastErrorNo:=oError:NativeError
NEXT
RETURN ( NIL )


Regards
Anser
Posts: 38
Joined: Tue Sep 30, 2008 11:16 AM
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 10:56 AM

Thank you Anser , but what is object oApp ?

regards
Wzaf

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 11:19 AM
Mr.Wzaf,

Instead of oApp:oConnection you may use your Connection Object

Code (fw): Select all Collapse
*---------------------------------------------------*
Function ShowSqlError(oConnection)
*---------------------------------------------------*
FOR EACH oError IN oConnection:Errors
   MsgInfo( " Error No:  "+AllTrim(STR(oError:NativeError))+CRLF+;
          " Descripcion :  "+oError:Description)
 NEXT
RETURN ( NIL )


Regards
Anser
Posts: 38
Joined: Tue Sep 30, 2008 11:16 AM
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 01:34 PM

Dear Anser,
sorry but doesn't work
I get always "Argument error: __OLEENUMCREATE"

in line :
FOR EACH oError IN oConnection:Errors

regards
Wzaf