Subject Re: [firebird-support] UDF on linux
Author Thomas Steinmaurer
Hello Dalton,

> I am having a problem with getting a udf to work on a linux box.
>
> Linux version : Ubuntu 9.4 Server edition 64 bit
> Firebird version : LI-V2.1.2.18118 Firebird 2.1 64 bit launched via xinetd, classic, installed via install script in /opt/firebird
> UDF Library : FreeUDFLibC downloaded from ibphoenix.com, compiled from source
>
> Here is some example DDL for one of the functions
>
> DECLARE EXTERNAL FUNCTION F_DAY_OF_MONTH
> Timestamp
> RETURNS Integer BY VALUE
> ENTRY_POINT 'day_of_month'
> MODULE_NAME 'FreeUDFLibC';
>
> The FreeUDFLibC UDF is found in /opt/firebird/UDF
>
> The UDF will register without error, but
> select F_DAY_OF_MONTH('02/12/2009') from RDB$DATABASE
>
> Results in
>
> Starting transaction...
> Preparing query: select F_DAY_OF_MONTH('02/12/2009') from RDB$DATABASE
> Error: *** IBPP::SQLException ***
> Context: Statement::Prepare( select F_DAY_OF_MONTH('02/12/2009') from RDB$DATABASE )
> Message: isc_dsql_prepare failed
>
> SQL Message : -104
> Invalid token
>
> Engine Code : 335544343
> Engine Message :
> invalid request BLR at offset 60
> function F_DAY_OF_MONTH is not defined
> module name or entrypoint could not be found
>
> Now, the problem also occurs with the UDF libraries that are supplied with firebird.
>
> DECLARE EXTERNAL FUNCTION ascii_char
> INTEGER
> RETURNS CSTRING(1) FREE_IT
> ENTRY_POINT 'IB_UDF_ascii_char' MODULE_NAME 'ib_udf';
>
> Commit;
>
> select ASCII_CHAR(65) from RDB$DATABASE;
>
> Results in
>
> Starting transaction...
> Preparing query: select ASCII_CHAR(65) from RDB$DATABASE
> Error: *** IBPP::SQLException ***
> Context: Statement::Prepare( select ASCII_CHAR(65) from RDB$DATABASE )
> Message: isc_dsql_prepare failed
>
> SQL Message : -104
> Invalid token
>
> Engine Code : 335544343
> Engine Message :
> invalid request BLR at offset 63
> function ASCII_CHAR is not defined
> module name or entrypoint could not be found
>
>
> Now, looking at my firebird.conf file
>
> RootDirectory= /opt/firebird/
> UdfAccess = Restrict '/opt/firebird/UDF'
>
> But I have also tried UdfAccess = Full
>
> To no avail.
>
> Does anyone know what I am doing incorrectly?

Perhaps a permission problem on /opt/firebird/UDF or a dependency
problem, that said, the UDF libraries expecting other libraries to be in
the path?

I've seen something similar on Windows when third-party UDF libraries
are expecting e.g. gds32.dll (or the equivalent on Linux) to be
installed ...

Although, it looks a bit strange that you also have a problem with the
library which comes with Firebird.


--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and
NexusDB V2
Upscene Productions
http://www.upscene.com
My blog:
http://blog.upscene.com/thomas/