FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Help :-( (Firebird / AdoRdd)
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Help :-( (Firebird / AdoRdd)
Posted: Tue May 05, 2009 11:50 PM

Hi,

I think I have become my own worst enemy :oops:

I have been looking at sqlwin, sqlrdd and adordd and now I am lost ... everything is starting to mix together :(

I have created a file called Fusion.gdb (firebird)
In Fusion.gdb I have a table called "Patients"

Can someone please help me connect to the database using adordd ? or SqlWin ?

I was able to connect to fusion.gbd with SQLRDD demo but I was never able to open "patients" and the cost is quite high.

I can open and view the "patients" table using IBEasy+ so I know the database is good.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Help :-(
Posted: Wed May 06, 2009 12:01 AM

Jeff:

If the Spanish language it doesn't matter for you, Have a look to my blog

http://sqlcmd.blogspot.com/

You'll find the basic steps to start with MySql & ADO. Btw ADO it's free, you have it in xHarbour.

And have a look the next link too.

http://connectionstrings.com/sql-server-2005

Best 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: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Help :-(
Posted: Wed May 06, 2009 01:15 AM

Thanks for the links Armando, however, I need to connect to Firebird not MySql.
(also I do not speak Spanish :wink: )

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Help :-(
Posted: Wed May 06, 2009 01:33 AM

Jeff:

Have a look to this link

http://connectionstrings.com/firebird

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: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Help :-(
Posted: Wed May 06, 2009 03:37 AM
I have installed MySql and have tried the following:

Code (fw): Select all Collapse
USE \FusionEMR\Data\Fusion.gdb VIA "ADORDD" TABLE "PATIENTS" MYSQL FROM "127.0.0.1" USER "fusion" PASSWORD "fusion"


When I launch my app I get this Error on the above line:

Error description: Error BASE/1003 Variable does not exist: S_CTABLENAME
Called From: adordd.prg=> ADO_OPEN(212)
Called From: => DBUSEAREA(0)
Called From: fusion.prg => OPENFILES(254)


At the top of my app I have:
#include "adordd.ch"
REQUEST ADORDD

NOTE:
I had to rebuild adordd.prg to match my version of xharbour ... I found some old instructions to create an OBJ from the prg so I have adordd.obj linked in instead of a LIB file. I don't know if it make any difference.
Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: Help :-(
Posted: Wed May 06, 2009 04:33 AM
Dear Jeff,

This sample works fine.
Code (fw): Select all Collapse
// Testing LOCATE and CONTINUE
#include "FiveWin.ch"
#include "adordd.ch"

REQUEST ADORDD

function Main()
// databae on web
   USE support VIA "ADORDD" TABLE "hotel" MYSQL ;
      FROM "www.easyfo.com" USER "user" PASSWORD "password"
/*
  // database on local disk
   USE php362 VIA "ADORDD" TABLE "SUPPORT_TOPIC" MYSQL ;
      FROM "localhost" USER "root" PASSWORD "password"
*/

   browse()

   USE

return nil


Regards,
Dutch
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Help :-(
Posted: Wed May 06, 2009 02:18 PM

I give up.

It looks like I need to stick with FireBird and I just can not get a connection. :?

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Help :-( (Firebird / AdoRdd)
Posted: Thu May 07, 2009 12:34 PM

Can anyone tell me if you can access a Firebird database via Adordd and use the standard xbase commands or am I going in the wrong direction?

I have tried a number of things and still have no luck.

Please, could someone please provide some sample code showing how to connect and "USE" a firebird database.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 437
Joined: Fri Oct 07, 2005 12:56 PM
Re: Help :-( (Firebird / AdoRdd)
Posted: Thu May 07, 2009 07:44 PM
Jeff Barnes wrote:Can anyone tell me if you can access a Firebird database via Adordd and use the standard xbase commands or am I going in the wrong direction?

I have tried a number of things and still have no luck.

Please, could someone please provide some sample code showing how to connect and "USE" a firebird database.


Jeff ,

Do you have an "data provider" to FireBird database ? Did you installed such things ? Like this - http://www.ibobjects.com/Ole_db.html ? You can't to connect to FireBird db through Ado if in yours computers doesn't exist OleDb drivers ...
Rimantas U.
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Help :-( (Firebird / AdoRdd)
Posted: Thu May 07, 2009 08:43 PM
Hi Rimantas,

I have installed this:
http://www.ibphoenix.com/main.nfs?a=ibp%20...%20bp_60_odbc

It is an ODBC driver (I have also created an entry in my data sources in the windows control panel)

Do I also need to install the driver from your link?

Also, can you provide a code sample so I can see how to connect?


I really appreciate everyone's help on this ... this is my first shot at SQL and sadly it is not going so well right now :-)
Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Help :-( (Firebird / AdoRdd)
Posted: Thu May 07, 2009 09:02 PM

Jeff

ODBC is not the way to go .. you do need the Firebird ole provider to connect via ADO.. Lots of reference and examples here .. search the forum for ADO .. also http://connectionstrings.com is a great resoruce for connecting to various datanases and their syntax.

Rick Lipkin

Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: Help :-( (Firebird / AdoRdd)
Posted: Fri May 08, 2009 02:03 AM
Hi Jeff,
So far this is what I've managed to cook up and some steps that I took in getting there.

1. Download and install Firebird server 2.0 series.

2. Download the free version of ADO driver from IBProvider
(NOTE: The free version supports up to Firebird 2.0 series only. Later versions require the commercial driver. See the list of differences here).

3. Finally FWH code that I use to do minor test.

Code (fw): Select all Collapse
#include "Fivewin.ch"
#include "Tcbrowse.ch"

//-------------
FUNCTION MAIN()

    LOCAL oRs, oErr
    local cConnStr := 'Provider=LCPI.IBProvider.3.Free;'+;
                  'Password=masterkey;User ID=sysdba;auto_commit=true;'+;
                  'Data Source=localhost:c:\employee.fdb;ctype="";dbclient_library=""'
    local oCon := CreateObject("ADODB.Connection")
    oCon:ConnectionString := cConnStr

    TRY
        oCon:Open()
    CATCH
        ShowAdoError(oCon)
        RETURN NIL
    END TRY

    oRs := CreateObject('ADODB.RecordSet')
    oRs:CursorLocation := 3
    TRY
      *oCon:BeginTrans()
      oRs:Open("SELECT CUSTOMER FROM CUSTOMER", oCon, 1, 3)
      *oCon:CommitTrans()
    CATCH
      ShowADOError(oCon)
    END

    msginfo("about to view")
    ? ors:fields("CUSTOMER"):value

    WBROWSERECORDSET( oRs )
    TCBROWSERECORDSET( oRs )

    oRs:Close()
    oCon:close()
    RETURN NIL


STATIC FUNCTION WBROWSERECORDSET( oRs )

    LOCAL oDlg, oBrw, nRec

    DEFINE DIALOG oDlg SIZE 300, 300

    @ 0, 0 LISTBOX oBrw FIELDS oRs:Fields( "CUSTOMER" ):Value;
           HEADERS "CLIENTI";
           ON RIGHT CLICK ( nRec := oRs:AbsolutePosition,;
                            oBrw:Report( "TWBrowse report", .T. ),;
                            oRs:MoveFirst(),;
                            oRs:Move( nRec - 1 ) )

    oBrw:bLogicLen = { || oRs:RecordCount }
    oBrw:bGoTop    = { || oRs:MoveFirst() }
    oBrw:bGoBottom = { || oRs:MoveLast() }
    oBrw:bSkip     = { | nSkip | Skipper( oRs, nSkip ) }
    oBrw:cAlias    = "ARRAY"

    ACTIVATE DIALOG oDlg;
             ON INIT oDlg:SetControl( oBrw );
             CENTER

    RETURN NIL


STATIC FUNCTION TCBROWSERECORDSET( oRs )

    LOCAL oDlg, oBrw, oCol, nRec

    DEFINE DIALOG oDlg SIZE 300, 300

    @ 0, 0 BROWSE oBrw;
           ON RIGHT CLICK ( nRec := oRs:AbsolutePosition,;
                            oBrw:Report( "TWBrowse report", .T. ),;
                            oRs:MoveFirst(),;
                            oRs:Move( nRec - 1 ) )

    ADD COLUMN TO oBrw;
               DATA oRs:Fields( "customer" ):Value;
               HEADER "CLIENTI"

    oBrw:lCellStyle = .T.

    oBrw:bLogicLen = { || oRs:RecordCount }
    oBrw:bGoTop    = { || oRs:MoveFirst() }
    oBrw:bGoBottom = { || oRs:MoveLast() }
    oBrw:bSkip     = { | nSkip | Skipper( oRs, nSkip ) }
    oBrw:cAlias    = "ARRAY"

    ACTIVATE DIALOG oDlg;
             ON INIT oDlg:SetControl( oBrw );
             CENTER

    RETURN NIL


STATIC FUNCTION SKIPPER( oRs, nSkip )

    LOCAL nRec := oRs:AbsolutePosition

    oRs:Move( nSkip )

    IF oRs:EOF; oRs:MoveLast(); ENDIF
    IF oRs:BOF; oRs:MoveFirst(); ENDIF

    RETURN oRs:AbsolutePosition - nRec

STATIC FUNCTION ShowAdoError(oCon)

LOCAL   nAdoErrors   := 0
LOCAL   oAdoErr

      nAdoErrors   :=  oCon:Errors:Count()
      IF nAdoErrors > 0
         oAdoErr      := oCon:Errors(nAdoErrors-1)
         msginfo( oAdoErr:Description + CRLF + oAdoErr:Source )
      ELSE
         msginfo( 'Not Oracle Error' )
      ENDIF

RETURN nil


There are a few ADO stuffs that I collected from the forum and posted it in one place here (http://wiki.fivetechsoft.com/doku.php?i ... ted_stuffs)
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour

Continue the discussion