Subject | Re: [IBO] Re: TIB_Session + TIB_Connection + TIB_Transaction + TIB_Cursor + Thread |
---|---|
Author | Robert Martin |
Post date | 2015-08-17T23:05:15Z |
Hi
It looks to me an issue is you are creating a seperate session
(pegaSecao function) for your Connection, transaction and query so they
all have different sessions. You should create a session first then
assign this to Connection, transaction and query.
Thanks
Rob
It looks to me an issue is you are creating a seperate session
(pegaSecao function) for your Connection, transaction and query so they
all have different sessions. You should create a session first then
assign this to Connection, transaction and query.
Thanks
Rob
On 18/08/2015 10:25 a.m., automacao.samos@... [IBObjects] wrote:
>
>
> function TEmpresasController.pegaConexao: TIBODatabase;
> var
> Conexao: TIBODatabase;
> begin
> try
> Conexao := TIBODatabase.CreateForSession(nil,pegaSecao);
> Conexao.DatabaseName := Caminho('PATH=');
> Conexao.Username := Caminho('USERNAME=');
> Conexao.PassWord := Caminho('PASSWORD=');
> Conexao.IB_Session := pegaSecao;
> Conexao.Activate;
> Result := Conexao;
> except
> on e: exception do gera_log(e.message);
> &nbs p; end;
> end;
>
> function TEmpresasController.pegaTransacao: TIBOTransaction;
> var
> Transacao: TIBOTransaction;
> begin
> try
> Transacao := TIBOTransaction.Create(nil);
> Transacao.IB_Connection := pegaConexao;
> Transacao.AutoCommit := True;
> Transacao.Isolation := tiConcurrency;
> Transacao.IB_Session := pegaSecao;
> Transacao.Activate;
> Result := Transacao;* except
> on e: exception do gera_log(e.message);
> end;
> end;
>
> function TEmpresasController.pegaSecao: TIB_Session;
> var
> Secao: TIB_Session;
> begin
> try
> Secao := TIB_Session.Create(nil);
> Result := Secao;
> except
> on e: exception do gera_log(e.message);
> end;
> end;
>
>
> function TEmpresasController.Abre_Tabelas(F_SQL:String):TIBOQuery;
> var
> Query : TIBOQuery;
> begin
> Query := TIBOQuery.Create(nil);
> Query.IB_Connection := pegaConexao;
> Query.IB_Transaction := pegaTransacao;
> Query.IB_Session := pegaSecao();
> try
> with Query do
> begin
> Close;
> UnPrepare;
> Sql.Clear;
> Sql.Add(F_SQL);
> Prepare;
> Open;
> end;
> result := Query;
> except
> on e: exception do gera_log(e.message);
> end;
>
> end;
>
> help please, report message: "transacion is not valid the current
> connection"
>
>
>
> No virus found in this message.
> Checked by AVG - www.avg.com <http://www.avg.com>
> Version: 2015.0.6125 / Virus Database: 4392/10456 - Release Date: 08/17/15
>
> *