Subject Re: UDF with string parameter in Terminal Server
Author Adam
--- In firebird-support@yahoogroups.com, "Gustavo" <gusm@...> wrote:
>
> Hello:
>
> I have a problem using an UDF with a string parameter in Terminal
Server.
>
> I wrote a simple UDF in Delphi. The code is the following:
>
> function MMPruebaString(CualAlias: PChar): PChar;
> begin
> Result:=CualAlias;
> end;
>
> Then I compiled it making MMudf.dll, I copied it in the server, in
"C:\Archivos de programa\Firebird\Firebird_2_0\UDF". Then I created a
DataBase and I declared the UDF with the following command:
>
> DECLARE EXTERNAL FUNCTION MMPruebaString
> CSTRING(1000)
> RETURNS CSTRING(1000) FREE_IT
> ENTRY_POINT 'MMPruebaString'
> MODULE_NAME 'MMudf';
>
>
> Then I connect to the database using IB_SQL IN THE SERVER, I execute
SELECT MMPruebaString('pepe') FROM RDB$DATABASE and it returns 'pepe'.
Good!
>
> Then I connect to the database using IB_SQL IN A CLIENT PC ON THE
LOCAL NETWORK, I execute SELECT MMPruebaString('pepe') FROM
RDB$DATABASE and it returns 'pepe'. Good!
>
> Then I connect to the database using IB_SQL CONNECTING VIA TERMINAL
SERVER TO THE SERVER (using LOCALHOST:), I execute SELECT
MMPruebaString('pepe') FROM RDB$DATABASE and it returns an empty
string. THAT´S NOT GOOD!!!
>
> What may be the problem?

We don't have any problems passing 'strings' to a UDF when connecting
through a terminal services session. All the work is being done
through fbserver.exe or fb_inet_server.exe, which is by default run as
SYSTEM.

Is it 2003 Server or something else?
Are you running Firebird as a service or application?
What user is the Firebird engine running as?
Which version of Firebird?
Are there other instances of Firebird or Interbase running on that
machine?

Maybe you can check the basics too. Try and remote desktop using the
/console option. This will let you log into the console session rather
than a virtual session so you can see if it works there. Check that
the dll you think is installed, and that the user running the firebird
engine has execute privileges to this dll.

Try out something in ib_udf that works with a string. For example.

DECLARE EXTERNAL FUNCTION substr .....

select substr('Hello World!', 2,5)
from RDB$DATABASE;

(Yes, this is a deprecated function because you now have substring
built into the engine itself, but you can test whether this really is
a terminal services issue or something about your custom dll).

Adam