FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour ADODB MySql! ( Solved! )
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Re: ADODB MySql error!
Posted: Mon Jan 26, 2009 06:43 PM

Exists any incompatibility with fields like timestamp?

Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: ADODB MySql error!
Posted: Mon Jan 26, 2009 07:27 PM
JC wrote:Antonio and friends,

This is my example for testing!
Please, modify and check!

http://rapidshare.com/files/189783905/ADODB.zip.html


I get

Application
===========
Path and name: E:\FWXHARB\ADODB.EXE (32 bits)
Size: 1,675,264 bytes
Time from start: 0 hours 0 mins 5 secs
Error occurred at: 01/26/09, 20:26:40
Error description: Error ADODB.RecordSet/6 DISP_E_UNKNOWNNAME: ACTIVECONNECTION
Args:
[ 1] = L .F.

Stack Calls
===========
Called from: source\rtl\win32ole.prg => TOLEAUTO:ACTIVECONNECTION(0)
Called from: ADODB.prg => MYSQLRECORDSET(152)
Called from: ADODB.prg => EXECCONNECTION(29)
Called from: ADODB.prg => MAIN(14)


EMG
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Re: ADODB MySql error!
Posted: Mon Jan 26, 2009 07:33 PM
Enrico,

You must be change the connectionString to your own configutarion:

cConnectionString := "Driver={MySQL ODBC 5.1 Driver}" + ;
                     ";Server=127.0.0.1"              + ;
                     ";DefaultDatabase=genesis"       + ;
                     ";Database=aservit"              + ;
                     ";Port=3306"                     + ;
                     ";User=genesis"                  + ;
                     ";Password=genesis"              + ;
                     ";Option=3;"
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: ADODB MySql error!
Posted: Mon Jan 26, 2009 07:36 PM

Sorry, I haven't MySql to test your sample.

EMG

Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Re: ADODB MySql error!
Posted: Mon Jan 26, 2009 07:40 PM
Enrico Maria Giordano wrote:Sorry, I haven't MySql to test your sample.

EMG


Don't have problem Enrico.. :-)
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: ADODB MySql error!
Posted: Mon Jan 26, 2009 08:07 PM
Julio:

I have tested your code, I modify the connection string (obviously), and
It works fine to me!.

Look






NOTE: I use 3.51 driver

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Re: ADODB MySql! Please Antonio...
Posted: Mon Jan 26, 2009 09:23 PM

Armando,

The problem is with fields that's type is timestamp!

Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Re: ADODB MySql! Please Antonio...
Posted: Mon Jan 26, 2009 10:46 PM
Dear friends,

Maybe the error is on datatype convertion of xHarbour, for fields like TIMESTAMP!

If you make a cast convertion, works!

reg_id = numeric, auto_increment, not null
reg_data = timestamp, notnull, default '0000-00-00 00:00:00'
reg_update = timestamp, notnull, default '0000-00-00 00:00:00'

Error:
SELECT reg_id, reg_data, reg_update FROM mytable ORDER BY reg_update DESC

When the field is filled with any value like '2009-01-27 16:42:25', the ADO return this value like this 2009-01-27, as date

Ok:
SELECT reg_id, CAST( reg_data AS CHARACTER ) AS reg_data, CAST( reg_update AS CHARACTER ) AS reg_update FROM mytable ORDER BY reg_update DESC

In this case, any value of field return a value like this '2009-01-27 16:42:25' as string (because typecast)


And xBrowse do not show the complete value of field... only the data part!
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Re: ADODB MySql! Please Antonio...
Posted: Tue Jan 27, 2009 12:48 PM

Someboby?

Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Re: ADODB MySql! Doubts to anybody!
Posted: Fri Jan 30, 2009 04:54 PM

I still have the problem, if somebody can help me.. thanks

Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Re: ADODB MySql! Doubts to anybody!
Posted: Mon Feb 02, 2009 06:47 PM

Dear friends,

Thanks for all! I can make this! Now, all it's ok with ADBODB.Connection, ADBODB.RecordSet and ADBODB.Stream with MySQL, PostgreSQL and Oracle... all they with Fivewin 8.10!

Thank so much!

Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 1956
Joined: Fri Oct 07, 2005 07:08 PM
Re: ADODB MySql! Please Antonio...
Posted: Mon Jul 06, 2009 02:55 PM
Es lo que me andaba pasando.

gracias.


JC wrote:Dear friends,

Maybe the error is on datatype convertion of xHarbour, for fields like TIMESTAMP!

If you make a cast convertion, works!

reg_id = numeric, auto_increment, not null
reg_data = timestamp, notnull, default '0000-00-00 00:00:00'
reg_update = timestamp, notnull, default '0000-00-00 00:00:00'

Error:
Code (fw): Select all Collapse
SELECT reg_id, reg_data, reg_update FROM mytable ORDER BY reg_update DESC

When the field is filled with any value like '2009-01-27 16:42:25', the ADO return this value like this 2009-01-27, as date

Ok:
Code (fw): Select all Collapse
SELECT reg_id, CAST( reg_data AS CHARACTER ) AS reg_data, CAST( reg_update AS CHARACTER ) AS reg_update FROM mytable ORDER BY reg_update DESC

In this case, any value of field return a value like this '2009-01-27 16:42:25' as string (because typecast)


And xBrowse do not show the complete value of field... only the data part!
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: ADODB MySql! ( Solved! )
Posted: Mon Jul 06, 2009 05:20 PM

XBrowse shows date part of DateTime values of xHarbour ( including TimeStamp field values of ADO ) by default. If we want full date time value to be shown in xBrowse, we should set oCol:cDataType := 'T'. Then xBrowse shows the values with date and time.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion