Maximum open cursors exceeded

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
mwgomez
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 11.07.2006, 16:02

Maximum open cursors exceeded

Post by mwgomez »

Ja hava an application in Delphi 7 and Zeos. I connect to Oracle 10g Express Edition. When I am trying insert record to a really small table I have an error:
"SQL Error: ORA-01000: maximum open cursor exceeded"

In the file INIT.ORA I found a line
open_cursors=300
and change it to:
open_cursors=1024
then restart the computer, but the problem appeard again


My source code is simple:

while not Eof(fh) do
begin
Readln(fh, text);

ZConnection.StartTransaction();
if not Write_2_table_ok(params) then
begin
err := true;
end;

if not err then
begin
ZConnection.Commit();
end
else begin
ZConnection.Rollback();
end;
end;

function Write_2_table_ok(params) source code:
...
try
with qInsert do
begin
Close();
SQL.Clear();

SQL.Add('insert into ');
SQL.Add(nazwa_tabeli + '(wiersz, godzina, cel_ip, cel_port) ');
SQL.Add('values :wiersz, :godzina, :cel_ip, :cel_port) ');

ParamByName('wiersz').AsString := wiersz;
ParamByName('godzina').AsString := godzina;
ParamByName('cel_ip').AsString := cel_ip;
ParamByName('cel_port').AsString := cel_port;

try
qInsert.ExecSQL();
except
isOK := false;
end;
end;
finally
qInsert.Close();
qInsert.SQL.Clear();
end;
...


Could you help me, please.

Regards
Terence
Zeos Dev Team
Zeos Dev Team
Posts: 141
Joined: 22.09.2005, 14:11
Location: Stuttgart
Contact:

Post by Terence »

If you only use ExeSql, you don't have to close a query.
Did you use TZquery for qInsert, or else?
How does your init part look like, or did you complety used dropping and setting of zeos object properties in object inspector ?
fabian
mwgomez
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 11.07.2006, 16:02

Post by mwgomez »

I am using only components:

a) TZConnection
I am changeing values (in Onject Insepector):
- Database
- Password
- Protocol (oracle)
- User

b) TZQuery
I am changeing values to (in Onject Insepector):
- Connection


The propert
- SQL
I am changeing in my programm


I Suppose I don't' init properly?


Regards
Terence
Zeos Dev Team
Zeos Dev Team
Posts: 141
Joined: 22.09.2005, 14:11
Location: Stuttgart
Contact:

Post by Terence »

Hm, looks pretty ok for me.
What happens if you leave the "close" 's out.
fabian
mwgomez
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 11.07.2006, 16:02

I find it

Post by mwgomez »

I find an answer. There is one thing to do.
The change is in the Zeos Source Code:

In the sorce code change:

destructor TZAbstractStatement.Destroy;
to new text:

{**
Destroys this object and cleanups the memory.
}
destructor TZAbstractStatement.Destroy;
begin
// Fabian: Begin fix of bug #1076975
Close;
// Fabian: End of fix
if Assigned(FBatchQueries) then
FBatchQueries.Free;

FBatchQueries := nil;
FConnection := nil;
FInfo.Free;
FLastResultSet := nil;

inherited Destroy;
end;

from:
http://sourceforge.net/tracker/index.ph ... tid=415826


Thank you for your help

Regards
Terence
Zeos Dev Team
Zeos Dev Team
Posts: 141
Joined: 22.09.2005, 14:11
Location: Stuttgart
Contact:

Post by Terence »

Ahh, this already is applied in testing branch. Will be officical with next release also.
http://users.telenet.be/mdaems
fabian
Post Reply