implement LETODB
Moderator: Rathinagiri
- fouednoomen
- Posts: 188
- Joined: Sun Oct 14, 2012 8:33 am
- DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL, Oracle, ODBC
- Location: Tunisia
Re: implement LETODB
how I can connect simultaneously to two LETODB servers from a workstation on the same application
thanks in advance
thanks in advance
- fouednoomen
- Posts: 188
- Joined: Sun Oct 14, 2012 8:33 am
- DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL, Oracle, ODBC
- Location: Tunisia
Re: implement LETODB
I just found this article on a site which confirms the possibility of simultaneously connecting to several servers from a single application but I cannot deploy the solution.
i need your help
i need your help
- Attachments
-
- image.jpg (238.27 KiB) Viewed 6519 times
Re: implement LETODB
Try this:
Note: Unlike to RDD "DBFNTX" when referencing DBF files in "LETO" (eg USE, DBCREATE) the default file extension ".DBF" cannot be used, causes error 1010 invalid characters in Alias.
Code: Select all
*******************************************************************************
#include "hmg.ch"
#include "dbinfo.ch"
//#include "leto_std.ch"
REQUEST LETO
//RDDSETDEFAULT( "DBFCDX" )
REQUEST HB_GT_WIN_DEFAULT
REQUEST HB_LANG_PL852
request HB_CODEPAGE_PL852
*----------------------------------------------------------------------------------*
Function Main
*----------------------------------------------------------------------------------*
Local i, plikDBF1, plikNTX1, plikDBF2, plikNTX2, lCreate, pola, plik
public cRDDDriver := "DBFNTX"
public cLocalRDDDriver := "DBFNTX"
public cLetoSerwer1 := "192.168.1.18"
public nLetoSerwerPort1 := 2812
public cLetoSerwer2 := "192.168.1.52"
public nLetoSerwerPort2 := 2812
public nHotbuf := 100
public nTimeOut := 6000
public lUseSerwerLeto1 := .F.
public nStatusLETO1 := -1
public cLetoSerwerPath1 := ""
public lAllowWorkWithoutLetoSerwer := .T.
Public cPath1 := ""
public lUseSerwerLeto2 := .F.
public nStatusLETO2 := -1
public cLetoSerwerPath2 := ""
Public cPath2 := ""
Public cLetoUser := ""
Public cLetoPass := ""
SET LANGUAGE TO POLISH
SET CODEPAGE TO POLISH
SET MULTIPLE OFF WARNING
set( _SET_CODEPAGE, "PL852" )
hb_LangSelect( 'PL852')
************************************
SETBLINK(.F.)
SETCANCEL(.F.)
SET MARGIN TO 0
SET SCOREBOARD OFF
SET WRAP ON
SET CONFIRM ON
SET DATE ANSI
SET ESCAPE OFF
@0,0 CLEA
if !( Empty( cLetoSerwer1 ) .OR. Empty(nLetoSerwerPort1) )
cLetoSerwerPath1 := "//" + Alltrim ( cLetoSerwer1 ) + ":" + Alltrim( Str( nLetoSerwerPort1 ) ) + "/"
lUseSerwerLeto1 := (( nStatusLETO1 := LETO_CONNECT( cLetoSerwerPath1, cLetoUser /*user*/, cLetoPass /*pass*/, nTimeOut /*timeout*/, nHotBuf /*hot buffer*/ )) >= 0)
? "nStatusLETO1", nStatusLETO1
if lUseSerwerLeto1
RDDSETDEFAULT( "LETO" )
cRDDDriver := "LETO"
cPath1 := cLetoSerwerPath1
? "1", LETO_GetServerVersion(), " at address: ", Leto_getLocalIP( .T. )
? "DBF DATABASE DRIVER :", LETO_DBDRIVER()[ 1 ], "MEMOTYPE:", LETO_DBDRIVER()[ 2 ]
? "CurrentConnection: ", LETO_GETCURRENTCONNECTION()
else
if lAllowWorkWithoutLetoSerwer
? "Brak połączenia z serwerem LETO1 ", cLetoSerwerPath1, leto_Connect_Err( .T. )
else
? "Brak połączenia z serwerem LETO1 ", cLetoSerwerPath1, leto_Connect_Err( .T. ), "Program zatrzymany!"
quit
endif
RDDSETDEFAULT( "DBFNTX" )
cRDDDriver := "DBFNTX"
endif
else
lUseSerwerLeto1 := .F.
endif
if !( Empty( cLetoSerwer2 ) .OR. Empty(nLetoSerwerPort2) )
cLetoSerwerPath2 := "//" + Alltrim ( cLetoSerwer2 ) + ":" + Alltrim( Str( nLetoSerwerPort2 ) ) + "/"
lUseSerwerLeto2 := (( nStatusLETO2 := LETO_CONNECT( cLetoSerwerPath2, cLetoUser /*user*/, cLetoPass /*pass*/, nTimeOut /*timeout*/, nHotBuf /*hot buffer*/ )) >= 0)
? "nStatusLETO2", nStatusLETO2
if lUseSerwerLeto2
RDDSETDEFAULT( "LETO" )
cRDDDriver := "LETO"
cPath2 := cLetoSerwerPath2
? "2", LETO_GetServerVersion(), " at address: ", Leto_getLocalIP( .T. )
? "DBF DATABASE DRIVER :", LETO_DBDRIVER()[ 1 ], "MEMOTYPE:", LETO_DBDRIVER()[ 2 ]
? "CurrentConnection: ", LETO_GETCURRENTCONNECTION()
else
if lAllowWorkWithoutLetoSerwer
? "Brak połączenia z serwerem LETO2 ", cLetoSerwerPath2, leto_Connect_Err( .T. )
else
? "Brak połączenia z serwerem LETO2 ", cLetoSerwerPath2, leto_Connect_Err( .T. ), "Program zatrzymany!"
quit
endif
RDDSETDEFAULT( "DBFNTX" )
cRDDDriver := "DBFNTX"
endif
else
lUseSerwerLeto2 := .F.
endif
? "UseLetoSerwer1", lUseSerwerLeto1
? "UseLetoSerwer2", lUseSerwerLeto2
? "RDD: ", RddSetDefault(), " , DBF EXTENSION:", hb_rddInfo( RDDI_TABLEEXT )
inkey ( 5 )
plikDBF1 := cPath1 + "MyFile1.DBF"
plikNTX1 := cPath1 + "Indeksy1.NTX"
lCreate := .F.
if !lUseSerwerLeto1
lCreate := !File( plikDBF1 )
else
lCreate := !Leto_file( plikDBF1 )
endif
? "Create file ", plikDBF1, lCreate
inkey (1)
if lCreate
pola := {}
AADD(pola, {'REGON','N',13,0})
AADD(pola, {'AKT','C',2,0})
AADD(pola, {'DATA','D',8,0})
//file on Leto server #1
DBCREATE( F_DBF (plikDBF1), pola )
DBUseArea(.T., cRDDDriver, F_DBF (plikDBF1), .f., .f.)
INDEX ON regon TO &plikNTX1
FOR i:=1 TO 10
APPEND BLANK
REPLACE regon WITH i
REPLACE akt WITH CHR(i+64)
REPLACE data WITH hb_date() - i
NEXT i
USE
endif
SELECT 1 //file on Leto server #1
plik := F_DBF ( plikDBF1 )
USE &plik INDEX &plikNTX1
? ALIAS()
go top
do while !eof()
? recno()
?? regon
?? akt
?? data
inkey(1)
skip
enddo
plikDBF2 := cPath2 + "MyFile2.DBF"
plikNTX2 := cPath2 + "Indeksy2.NTX"
lCreate := .F.
if !lUseSerwerLeto2
lCreate := !File( plikDBF2 )
else
lCreate := !Leto_file( plikDBF2 )
endif
? "Create file ", plikDBF2, lCreate
inkey (1)
if lCreate
pola := {}
AADD(pola, {'REGON','N',13,0})
AADD(pola, {'AKT','C',2,0})
AADD(pola, {'DATA','D',8,0})
//file on Leto server #2
DBCREATE( F_DBF (plikDBF2), pola )
DBUseArea(.T., cRDDDriver, F_DBF (plikDBF2), .f., .f.)
INDEX ON regon TO &plikNTX2
USE
endif
SELECT 2 //file on Leto server #2
plik := F_DBF ( plikDBF2 )
USE &plik INDEX &plikNTX2
SELECT 1 //file on Leto server #1
GO TOP
DO WHILE !EOF()
SELECT 2 //file on Leto server #2
APPEND BLANK
REPLACE 2->regon WITH 1->regon
REPLACE 2->akt WITH 1->akt
REPLACE 2->data WITH 1->data
SELECT 1 //file on Leto server #1
SKIP
ENDDO
SELECT 2 //file on Leto server #2
? ALIAS()
go top
do while !eof()
? recno()
?? regon
?? akt
?? data
inkey(1)
skip
enddo
close data
Leto_Disconnect( cLetoSerwerPath1 )
Leto_Disconnect( cLetoSerwerPath2 )
? "press any key to exit...."
inkey(0)
QUIT
RETURN
*********************************************
FUNCTION F_DBF ( cFileName )
RETURN hb_FNameExtSet(cFileName, "")
Re: implement LETODB
After I add the following line in my main prg, error occurs while compiling.
REQUEST leto
error on compiling:
hbmk2: Error: Referenced, missing, but unknown function(s): LETO()
Regards,
Ramesh Bhat.
REQUEST leto
error on compiling:
hbmk2: Error: Referenced, missing, but unknown function(s): LETO()
Regards,
Ramesh Bhat.
Re: implement LETODB
1. Download the package from Marek containing the library "librddleto_20190517.a" (link: http://hmgforum.com/viewtopic.php?p=65987#p65987)
2. Place the downloaded file librddleto_20190517.a in the folder c:\hmg.3.4.4\lib\
3. If you are using the IDE, in the project's * .hbc configuration file enter: libs=rddleto_20190517
or
3. If you are using build.bat: your command line should look like this: call c:\hmg.3.4.4\build.bat project.hbp -lrddleto_20190517
2. Place the downloaded file librddleto_20190517.a in the folder c:\hmg.3.4.4\lib\
3. If you are using the IDE, in the project's * .hbc configuration file enter: libs=rddleto_20190517
or
3. If you are using build.bat: your command line should look like this: call c:\hmg.3.4.4\build.bat project.hbp -lrddleto_20190517
Re: implement LETODB
Thank you EDK.
Now it is compiling OK using IDE.
Build.bat still giving same error.
my command prompt build command is:
build.bat jt.hbp jt.hbc
jt.hbc given below:
incpaths=
libpaths=
libs=rddleto_20190517
gt=
mt=yes
Regards,
Bhat.
Now it is compiling OK using IDE.
Build.bat still giving same error.
my command prompt build command is:
build.bat jt.hbp jt.hbc
jt.hbc given below:
incpaths=
libpaths=
libs=rddleto_20190517
gt=
mt=yes
Regards,
Bhat.
Re: implement LETODB
Try:
build.bat jt.hbp -lrddleto_20190517
build.bat jt.hbp -lrddleto_20190517
Re: implement LETODB
Hi!
I want to refresh this topic.
Now, I need to connect to read and write data from php application.
Sample attached to leto is working,but it shows only a few information.
Did anybody realize change data from PHP to DBF and vice versa?
I want to refresh this topic.
Now, I need to connect to read and write data from php application.
Sample attached to leto is working,but it shows only a few information.
Did anybody realize change data from PHP to DBF and vice versa?
- dragancesu
- Posts: 921
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
Re: implement LETODB
PHP and DBF is not natural connect, I think, but exist
https://github.com/luads/php-xbase
https://www.yinfor.com/2017/04/connect- ... cript.html
https://www.miva.com/forums/forum/onlin ... s-with-php
https://github.com/luads/php-xbase
https://www.yinfor.com/2017/04/connect- ... cript.html
https://www.miva.com/forums/forum/onlin ... s-with-php