You are not logged in.
Pages: 1
I'm using Zeos 7.0.3-stable and Interbase 7.5.1 (legacy database). Current zeos is buggy for interbase server.
Here is my server code:
program MyHTTPServer;
{$APPTYPE CONSOLE}
uses
SysUtils,
SynDB,
SynDBZeos,
SynDBSQLite3,
SynSQLite3Static,
SynDBRemote,
SynCommons,
SynLog;
var
Props : TSQLDBConnectionProperties;
HttpServer : TSQLDBServerAbstract;
begin
with TSynLog.Family do
begin
Level := LOG_VERBOSE;
EchoToConsole := LOG_VERBOSE;
end;
Props := TSQLDBZEOSConnectionProperties.Create('zdbc:interbase-6://localhost:3050','d:\data\inter1314.ib','sysdba','masterkey');
HttpServer := TSQLDBServerHttpApi.Create(Props,'syndbremote','8092','user','pass');
writeln('Server running.....');
Readln;
HttpServer.Free;
Props.Free;
end.
and here is the server log:
12:36:30 PM Enter TSQLDBZEOSStatement(0134D640).0050A7C8
12:36:30 PM SQL TSQLDBZEOSStatement(0134D640) insert into area(ano, aname) values(2, 'MULTAN')
12:36:30 PM Exception EZSQLException ("SQL Error: violation of PRIMARY or UNIQUE KEY constraint \"AREA_PK\" on table \"AREA\". Error Code: -803. Invalid insert or update value(s): object columns are\nconstrained - no 2 table rows can have duplicate column values The SQL: insert into area(ano, aname) values(?, ?); ") at 004D4447 stack trace API 00434734 00404258
12:36:30 PM Exception EZSQLException ("SQL Error: Dynamic SQL Error SQL error code = -501 Attempt to reclose a closed cursor. Error Code: -501. The cursor identified in a FETCH or CLOSE statement is not open.") at 004D4447 stack trace API 00434734 00404258
Hi All,
When I insert a duplicate key value I receive this strange error from remote WinHttpServer :
TSQLDBWinHTTPConnectionProperties.Process(cExecute): server raised EZSQLException with "SQL Error: Dynamic SQL Error SQL error code = -501 Attempt to reclose a closed cursor. Error Code: -501. The cursor identified in a FETCH or CLOSE statement is not open."
here is code:
procedure TfrmAreaAdd.btnAddClick(Sender: TObject);
var code, err: integer;
q : TQuery;
begin
val (edtCode.Text,code, err);
if code <= 0 then
begin
Showmessage('Invalid area code');
edtCode.SetFocus;
exit;
end;
if Trim(edtName.Text) = '' then
begin
Showmessage('Invalid area name');
edtCode.SetFocus;
exit;
end;
q := TQuery.Create(dm.fProps.MainConnection);
try
dm.fProps.MainConnection.StartTransaction;
try
q.SQL.Add('insert into area(ano, aname) values(:code, :name) ');
q.ParamByName('code').AsInteger := code;
q.ParamByName('name').AsString := edtName.Text;
q.ExecSQL;
dm.fProps.MainConnection.Commit;
q.Close;
ShowMessage('Area added');
edtCode.Text := '';
edtName.Text := '';
except
on e:exception do
begin
dm.fProps.MainConnection.Rollback;
ShowMessage(e.Message);
end;
end;
finally
q.free;
end;
end;
Shahid
Pages: 1