Subject Re: [firebird-support] UDF problems
Author Helen Borrie
At 07:41 PM 5/04/2005 +0000, you wrote:

>I'm having problems running UDFs. I'm using the .Net embedded
>UDF path is mapped correctly via the config variables RootDirectory
>and UdfAccess (left as the default). I know this is correct because
>before mapping I'd get the error:
>Access to UDF library \"ib_udf.DLL\" is denied by server administrator
>Once the mapping was fixed I no longer got that error.
>I make sure I run the following SQL statement:
>Then I run this SQL query:
>select strlen('abc') from dummy;
>And get the error:
>invalid request BLR at offset 60\nfunction STRLEN is not defined
>I know the "DECLARE EXTERNAL..." statement worked because if it's not
>run I get the error:
>Dynamic SQL Error\nSQL error code = -804\nFunction unknown\nSTRLEN
>So ... if someone might offer some help I sure would appreciate it.
>This is pretty critical.

The one thing not accounted for here is that your copy of ib_udf.dll is
actually located in the place that your firebird.conf says it is. If you
are running embedded, then the default relative path (which you say you
didn't alter) simply may be wrong. The default entry (commented out in
firebird.conf) is

#UdfAccess = Restrict UDF

What that means is that (for a regular server install on Windows), the UDF
libraries are located in
c:\Program Files\Firebrd\Firebird_1_5\UDF

That is, UDF's default location is expressed relative to the Firebird root
directory. Note that the Firebird root directory is NOT the same as your
application directory (where FbEmbed.dll resides). It is the directory
*above* the directory where the server binaries are located (which, in the
default full server installation, is .
c:\Program Files\Firebrd\Firebird_1_5\bin

Do you see the problem here? Your embedded app doesn't really have a
"root" from which the (embedded) engine can locate the default pieces by
relative location.

So - the solution for your embedded setup is to provide the absolute path
to the directory where you have the UDF libraries - and, of course, to
uncomment the parameter!!

Let's say your application and fbEmbed.dll are in c:\MyApp. For
convenience/example/tidiness (since it can be whatever and wherever you
choose, as long as the logged-in user has permissions), create a
subdirectory named UDF beneath the MyApp dir, viz. c:\MyApp\UDF. Then,
change your firebird.conf entry to:

UdfAccess = Restrict c:\MyApp\UDF

Remember to stop and restart the application, so that the embedded engine
gets a fresh view of firebird.conf.