Subject Re: [IBO] IBObjects with DataSnap Rest throws fbclient.dll access violation
Author Geoff Worboys
> The following small code works fine in any project. However,
> when I call it from a DataSnap server method, the Open()
> throws "Access violation at address 05CE29DB in module
> 'fbclient.dll'. Write of address 00000044"

> TIB_Connection* db = new TIB_Connection(this);
> db->Connected=false;
> db->Username="SYSDBA";
> db->Password="masterkey";
> db->Path="e:\\bd\\MyDb.fdb";
> db->Protocol=cpTCP_IP;
> db->Server="localhost/3050";
> db->Open();

> The project is the predefined DataSnap Rest server project of
> Rad Studio. Then, in a method, I copy the above code.

> If I call the same code from a button added in the same
> DataSnap project, it works without problem.

> I am totally blocked. Any help or guideline will be welcome.

I've not used DataSnap components, but my first guess would
be a threading problem (the server presumably runs in its own
thread). As such you may need to create a TIB_Session.

TIB_Session* sess = new TIB_Session(this);
TIB_Connection* db = new TIB_Connection(this, sess);
...etc...

All your IBO components will need to be created for the the
specific session rather than reverting to the default.

--
Geoff Worboys
Telesis Computing Pty Ltd