Página 1 de 1

connect simultaneously to 2 LETODB servers

Enviado: 27 Mai 2021 08:07
por noomen
how I can connect simultaneously to two LETODB servers from a workstation on the same application

thanks in advance

connect simultaneously to 2 LETODB servers

Enviado: 27 Mai 2021 12:24
por alxsts
Welcome to this Forum noomen!

Please, refer to this material: Can a single program to run multiple LetoDB servers?

connect simultaneously to 2 LETODB servers

Enviado: 27 Mai 2021 13:27
por Itamar M. Lins Jr.
Hi!

If use LetoDBf.

Read the file of letodbf README.TXT
3.2 Run as Windows@ service

For use as "Windows service" server executable must be compiled for this task, see 2.1
To install LetoDbf as service, the executable must be placed in a directory covered by the OS
system search paths to be found from any place. Then run letodb with 'install' parameter:
letodb.exe install [letodb.ini]
The 3rd param is optinonal for different config to use for multiple LetoDBf services, e.g.
running at different disk partitions.

Verify in letodbf.log that the service was successful installed and started.
To check the state of a Windows service use the GUI management for services.
Alternatively at command line can be used to start/ stop the service:
net start LetoDBf_Service
net stop LetoDBf_Service
Port = 2812 - Server port number, default is 2812 [ then 2813 used for second socket ]
There are two! ports used by server, this and the following number.
If change PORT via letodb.ini for 2820 (example) second socket up 2821

Best regards,
Itamar M. Lins Jr.

connect simultaneously to 2 LETODB servers

Enviado: 12 Jul 2024 12:49
por deividdjs
boa tarde, Prezados!

até agora não consegui fazer funcionar dois servidores simultâneos .. alguém já ??

dá uma luz por favor .. ja fiz conforme manual e nada ..

liberei no firewall as portas 2812 e 2813

criei dois arquivos letodb1.ini e letobd2.ini com suas respectivas configurações e nada ..

alguem ja conseguiu fazer ??

Abraço !

Djs

connect simultaneously to 2 LETODB servers

Enviado: 12 Jul 2024 13:28
por Itamar M. Lins Jr.
Olá!
Aqui foi de boa.
c:\dev\letodbf\bin
Coloquei na porta padrão 2812

Código: Selecionar todos

Port = 2812              
c:\dev\letodbf\bin\bin2
Coloquei na porta padrão 2820

Código: Selecionar todos

Port = 2820              
Detalhe!
Usei o letodb.hbp não usei o serviço.
Dois letodb.exe e dois letodb.ini
Se for usar o serviço precisa mudar o nome do outro "letodbf_service" NOS FONTES! quando for compilar usando letodbsvc.hbp
Dai não quiz mexer.

Saudações,
Itamar M. Lins Jr.

connect simultaneously to 2 LETODB servers

Enviado: 12 Jul 2024 17:03
por deividdjs
vlw Itamar .. mudando o nome do serviço e compilando outro letodbf acredito q foi mais facil .. hehehe funcionou !! abs!

connect simultaneously to 2 LETODB servers

Enviado: 13 Jul 2024 22:26
por deividdjs
Boa noite Itamar .. mais uma pergunta tu q é mestre no LETODBF ...

no meu sistema eu tenho a estrutura de pasta assim :

\CONTROLE_\LOJA_00
\CONTROLE_\LOJA_01
\CONTROLE_\LOJA_03

e asssim por diante ....

antes do LETODBF instalado eu usava a função DIRCHANGE(LOJA_01)... (LOJA_02) e assim por diante para comutar os diretorios e acessar as bases q aí estão ... como faço essa tarefa com o LETO ??

Abraço amigo ..

Djs.

connect simultaneously to 2 LETODB servers

Enviado: 14 Jul 2024 12:04
por Itamar M. Lins Jr.
Olá!
Tem duas opções:

Código: Selecionar todos

      LETO_SETPATH( cPath[, lDefault ] )                         ==> cOldPath
 It set "SET PATH TO ( cPath )" at LetoDBf server.
 This path(s) are relative to "DataPath" in 'letodb.ini' configuration and are searched for DBF tables
 when *plain* table filenames without a path component are used for DbUseArea()/ DbSetIndex().
 With optional given <lDefault> as true (.T.), "SET DEFAULT TO ( cPath )" is set at server,
 then this will become a subdirectory of "DatPath" where *new* tables are created.
 Also herefor filename must be given in *plain* form -- when containing a path, filenames are ever
 treated as relative to 'DataPath'.
 Setting the DEFAULT path also set 'DataPath' of 'letodb.ini' as search PATH, if its not already set.
 Setting a search PATH also adds 'DataPath' itself as additional last search PATH.
 <cOldPath> will be just a single ";" if no connection active or else error occured, else it is
 the relative path(s) formerly active -- useful to temporary change and reset back to before.
 Please note that no verification is done if the paths already exist, so non existing paths will
 lead to not found files or even an create error.
E como vc pode fazer tudo dentro das pasta PRINCIPAL. Pode criar, apagar, etc ficando na pasta principal.

Código: Selecionar todos

    Leto_Directory( [ cDir ] [, cnAttr] )                    ==> aDirectory
 Returns a content of directory at the server in the same format as Directory() function.
 With no given <cDir> the DataPath root directory is used.

      Leto_DirExist( cPath )                                   ==> lDirExists
 Determine if cirectory exist at the server, analog of Leto_File() function, but
 for directories

      Leto_DirMake( cPath )                                    ==> -1 if failed
 Creates a directory at the server. [ renamed, formerly: Leto_MakeDir ]

      Leto_DirRemove( cPath )                                  ==> -1 if failed
 Deletes a directory at the server
Eu não uso a primeira opção. Pq tem que lembrar de voltar para a pasta principal, ou os comandos("use, leto_file(), etc) irão dar problema. Evitei usar.

Saudações,
Itamar M. Lins Jr.

connect simultaneously to 2 LETODB servers

Enviado: 14 Jul 2024 12:10
por Itamar M. Lins Jr.
Olá!
Eu usaria:

Código: Selecionar todos

use \LOJA_00\estoque.dbf ...
use \LOJA_01\estoque.dbf ...
use \LOJA_03\estoque.dbf ...
...
IF LETO_FILE("\LOJA_00\estoque.dbf")
IF LETO_FILE("\LOJA_01\estoque.dbf")
IF LETO_FILE("\LOJA_03\estoque.dbf")
Uma vez que, a pasta principal está setada no DataPath=\controle

Saudações,
Itamar M. Lins Jr.

connect simultaneously to 2 LETODB servers

Enviado: 14 Jul 2024 16:12
por deividdjs
entendi! o unico problema é q tenho q mudar toda a estrutura do meu sistema .. e se eu conseguisse mudar de pasta ... não teria q mexer em nada !

seria muito bom se essa função Leto_SetPath( cLoja, .T. ) funcionasse como o DIRCHANGE(cLoja) ... AÍ eu estaria no céu ..rsrs mais fiz varios testes e não funciona igual ... mais blz .. vou ver o q eu faço ..

Obrigado meu amigo ... forte abraço!

Sds,

Deivid

connect simultaneously to 2 LETODB servers

Enviado: 18 Jul 2024 19:46
por JoséQuintas
Pelo que entendi do texto é isso mesmo que voce quer.

Se no servidor é pasta \leto\lojas\lojaxx

Vai configurar o servidor como \leto\lojas

E no terminal vai usar path lojaxx ou \lojaxx

É o que o texto diz, a posição vai ser relativa à pasta configurada no leto, que passou a ser a raiz enxergada pelo terminal.
Faça o teste com e sem a barra.
Aí só precisaria desse leto_SetPath(), sem precisar mexer em todos os fontes.

Confirme o que acontece numa reconexão e/ou em mais terminais ou até no mesmo terminal com o aplicativo aberto várias vezes.
É bom pra não ter surpresas depois.

Nota: não inventariam leto_SetPath() se não fosse pra algo assim.