Zeos 7 + Oracle 11g - BUG
Posted: 29.05.2014, 22:10
Hi.
I found some strange problem in Zeos 7.1.3 Stable using Oracle 11g R2.
If I open many connections e close them, the database give me this error "ORA-12516: TNS:listener could not find available handler with matching" and the number of sessions in the database goes to the limit.
This problem does not happen using Zeos 6.
This is an example of my code:
-------------------------------------------------
procedure TForm1.Button1Click(Sender: TObject);
var
MyThread1, MyThread2, MyThread3 : TMyThread;
begin
bStop := not bStop;
if bStop then
Button1.Caption := 'Stop'
else
Button1.Caption := 'Start';
Sleep(3000);
ZConnection1.HostName := edtHost.Text;
ZConnection1.Port := edtPort.Value;
zConnection1.Catalog := edtInstance.Text;
zConnection1.Database := edtInstance.Text;
ZConnection1.User := edtUser.Text;
ZConnection1.Password := edtPass.Text;
if bStop then
begin
MyThread1 := TMyThread.Create(False);
with MyThread1 do
begin
Sender := Self;
FreeOnTerminate := True;
Resume;
end; //with
MyThread2 := TMyThread.Create(False);
with MyThread2 do
begin
Sender := Self;
FreeOnTerminate := True;
Resume;
end; //with
MyThread3 := TMyThread.Create(False);
with MyThread3 do
begin
Sender := Self;
FreeOnTerminate := True;
Resume;
end; //with
end;
end;
{ TMyThread }
procedure TMyThread.Execute;
var
con: TZConnection;
qry: TZQuery;
begin
while Sender.bStop do
begin
try
con := TZConnection.Create(nil);
try
con.HostName := Sender.ZConnection1.HostName;
con.Port := Sender.ZConnection1.Port;
con.Catalog := Sender.zConnection1.Catalog;
con.Database := Sender.zConnection1.Database;
con.User := Sender.ZConnection1.User;
con.Password := Sender.ZConnection1.Password;
con.Protocol := Sender.ZConnection1.Protocol;
if not con.Connected then
con.Connect;
con.StartTransaction;
qry := TZQuery.Create(nil);
try
qry.Connection := con;
qry.SQL.Text := 'select * from dual';
qry.Open;
qry.Close;
finally
if Assigned(qry) then
FreeAndNil(qry);
end;
if con.InTransaction then
con.Commit;
if con.Connected then
con.Disconnect;
finally
if Assigned(con) then
FreeAndNil(con);
end;
except
on E: Exception do
Sender.SaveToFile(E.Message + #13#10, 'C:\ZeosOracle.txt');
end;
end;
inherited;
end;
-----------------------------------
Thx
I found some strange problem in Zeos 7.1.3 Stable using Oracle 11g R2.
If I open many connections e close them, the database give me this error "ORA-12516: TNS:listener could not find available handler with matching" and the number of sessions in the database goes to the limit.
This problem does not happen using Zeos 6.
This is an example of my code:
-------------------------------------------------
procedure TForm1.Button1Click(Sender: TObject);
var
MyThread1, MyThread2, MyThread3 : TMyThread;
begin
bStop := not bStop;
if bStop then
Button1.Caption := 'Stop'
else
Button1.Caption := 'Start';
Sleep(3000);
ZConnection1.HostName := edtHost.Text;
ZConnection1.Port := edtPort.Value;
zConnection1.Catalog := edtInstance.Text;
zConnection1.Database := edtInstance.Text;
ZConnection1.User := edtUser.Text;
ZConnection1.Password := edtPass.Text;
if bStop then
begin
MyThread1 := TMyThread.Create(False);
with MyThread1 do
begin
Sender := Self;
FreeOnTerminate := True;
Resume;
end; //with
MyThread2 := TMyThread.Create(False);
with MyThread2 do
begin
Sender := Self;
FreeOnTerminate := True;
Resume;
end; //with
MyThread3 := TMyThread.Create(False);
with MyThread3 do
begin
Sender := Self;
FreeOnTerminate := True;
Resume;
end; //with
end;
end;
{ TMyThread }
procedure TMyThread.Execute;
var
con: TZConnection;
qry: TZQuery;
begin
while Sender.bStop do
begin
try
con := TZConnection.Create(nil);
try
con.HostName := Sender.ZConnection1.HostName;
con.Port := Sender.ZConnection1.Port;
con.Catalog := Sender.zConnection1.Catalog;
con.Database := Sender.zConnection1.Database;
con.User := Sender.ZConnection1.User;
con.Password := Sender.ZConnection1.Password;
con.Protocol := Sender.ZConnection1.Protocol;
if not con.Connected then
con.Connect;
con.StartTransaction;
qry := TZQuery.Create(nil);
try
qry.Connection := con;
qry.SQL.Text := 'select * from dual';
qry.Open;
qry.Close;
finally
if Assigned(qry) then
FreeAndNil(qry);
end;
if con.InTransaction then
con.Commit;
if con.Connected then
con.Disconnect;
finally
if Assigned(con) then
FreeAndNil(con);
end;
except
on E: Exception do
Sender.SaveToFile(E.Message + #13#10, 'C:\ZeosOracle.txt');
end;
end;
inherited;
end;
-----------------------------------
Thx