Subject error when remote connecting
Author duilio_fos
I am using IBO3, Delphi3 and Firebird 1.02

I wrote a very simple program.

There is a single form with a TPageControl.

In the active page of the TPageControl, there is a TDBGrid.

In the OnFormCreate event of the form, this TDBGrid is filled by a
TIBOQuery.

The SQL code is

with ArtQry do
begin
DatabaseName:='cb4db';
RequestLive:=False;
SQL.Clear;
SQL.Add('select');
SQL.Add('cod_art ,');
SQL.Add('des_art ,');
SQL.Add('giac4 ,');
SQL.Add('giac3 ,');
SQL.Add('giac2 ,');
SQL.Add('giac1 ');
SQL.Add('from ');
SQL.Add('PikArtAllMag(:cur_dat)');
Prepare;
ParamByName('cur_dat').AsDateTime:=CurDat;
ExecSQL;


PikArtAllMag is a SP that returns all items and the quantities in
stock in different warehouses.

This works ok.

When the user selects the 2nd page of the TPageControl, I want to
show the last purchases of the item selected.

To this aim, I build the following query:

with AcqQry do
begin
DatabaseName:='cb4db';
sql.Add('select first 20 a.d_mov, a.n_mov, c.des_cf, b.qta,
b.um from ');
sql.Add('mv_hd a, mv_li b, tb_cf c, tb_cau1 d where');
sql.Add('a.y_mov=b.y_mov');
sql.Add('and');
sql.Add('a.n_mov=b.n_mov');
sql.Add('and');
sql.Add('a.cod_cf=c.cod_cf');
sql.Add('and');
sql.Add('a.cod_cau=d.cod_cau');
sql.Add('and');
sql.Add('a.cod_mag=:cod_mag');
sql.Add('and');
sql.Add('b.cod_art=:cod_art');
sql.Add('and');
sql.Add('(d.q_c_acq+d.q_c_div)>0');
sql.Add('order by d_mov desc');
end;

When the event OnChange of the TPageControl is triggered, I prepare,
the execute the query above

with AcqQry do
begin
Close;
Prepare;
ParamByName('cod_art').AsString:=CurrentArt;
ParamByName('cod_mag').AsString:=CurrentAcqMag;
Open;
end;

This code works ok when:

1. I work on a local database
2. I work on a remote database in a LAN

However, when I run the application against a remote database
connected via a slow TCP/IP modem connection, I get the following
error message:

335544569 ISC ERROR CODE: 335544569

ISC ERROR MESSAGE:
DYNAMIC SQL ERROR
SQL ERROR CODE= -104
TOKEN UNKNOWN - line 1, char 14
20

STATEMENT
TIBOInternal
Dataset:"<TApplication>.Form1.Desform.AcqQry.IBOqrAcqQry."

Any idea re the cause of the problem ?

TIA

Duilio Foschi