Page 1 of 1

Maximum open cursors exceeded

Posted: 12.07.2006, 15:52
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

Posted: 12.07.2006, 16:18
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 ?

Posted: 12.07.2006, 20:48
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

Posted: 13.07.2006, 08:08
by Terence
Hm, looks pretty ok for me.
What happens if you leave the "close" 's out.

I find it

Posted: 13.07.2006, 15:28
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

Posted: 13.07.2006, 15:39
by Terence
Ahh, this already is applied in testing branch. Will be officical with next release also.
http://users.telenet.be/mdaems