2

I work in Firebird 2.5 database:

Occasionally (not always) I get the following error when I run some stored procedures or views (database objects) that use the LRTRIM function:

Invalid token. invalid request BLR at offset 623 function LRTRIM is not defined module name or entrypoint could not be found Error while parsing procedure XXXXXXX (stored_procedure name) ;

(I get this both in IB Expert and SSRS)

This said I am able to access other database objects that do not use LRTRIM function!

I had a similar issue with LTRIM, now I am getting LRTRIM. I had copied firebird.msg from Firebird folder to Windows folder a few days back, and this is the new error message I get.

My temporary workaround:

Sometimes I restart the machine, and am able to run these same stored procedures and views that threw this error sometime back. At other times, I restart the machine a couple of times, and am able to access these views and stored procedures.

At some other times, I restart the machine many times, still not able to run the database objects. I get frustrated and quit for the day. When I open the machine fresh the next morning, I am able to run these objects again.

What could be the reason for this? And what will be the permanent solution?

**Now I have this: In the 32-bit folder: C:\Program Files (x86)\Firebird\Firebird_2_5\udf , I find these 8 files: fbudf.dll,fbudf.sql,fbudf.txt,ib_udf.dll,ib_udf.sql,ib_udf2.sql,udf.dll,UDFPrici‌​ng.dll ;

But in the 64-bit folder: C:\Program Files\Firebird\Firebird_2_5\UDF , I find these 6 files: fbudf.dll,fbudf.sql,fbudf.txt,ib_udf.dll,ib_udf.sql,ib_udf2.sql (I do NOT find the last 2 .dll files - udf.dll and UDFPricing.dll - that are present in the 32-bit folder)**

user3812887
  • 439
  • 12
  • 33
  • `LRTRIM` looks like a typo (for `LTRIM`), are you sure that 1) it is `LRTRIM` and that 2) you actually have an UDF definition for `LRTRIM`, and that 3) your UDF library (or libraries) actually have an entrypoint for whatever is defined for the `LRTRIM` UDF? – Mark Rotteveel Oct 12 '15 at 13:01
  • 1
    This question is asked several times and have an answer in the comments. http://stackoverflow.com/questions/32840414/firebird-2-5-invalid-request-blr-623-ltrim-not-defined-entrypoint-not-found Please learn the difference between Firebird client and server ( for example from here :http://www.firebirdsql.org/manual/ufb-cs.html or here : http://www.firebirdsql.org/manual/ufb-cs-clientlib.html, – Val Marinov Oct 12 '15 at 13:02
  • @ValMarinov That question was asked by the same user and the only difference seems to be that one was about LTRIM, and this about LRTRIM. – Mark Rotteveel Oct 12 '15 at 13:04
  • @Mark I think this is tipo. – Val Marinov Oct 12 '15 at 13:05
  • As I also commented on the bugreport you posted on the Firebird tracker, you should really post this on the firebird-support mailinglist. You either have a very persistent problem with your server setup, or something else is wrong that needs more troubleshooting than is possible on a Q&A site like StackOverflow. Please check http://www.firebirdsql.org/en/mailing-lists/ for how to subscribe to firebird-support. – Mark Rotteveel Oct 12 '15 at 13:08
  • Hi Mark/Val, Its not a typo; last time it was LTRIM, now its LRTRIM, after I put the Firebird.msg into Windows folder (you can see this difference - 'Invalid Token' - a message appears, unlike last time). I will thoroughly look into the UDF libraries, and get back. The only reason why I have not done is that this issue does not occur always. For example, I did not have this problem for the last 5-6 days, and hence went ahead with my development SSRS work. And suddenly its back. This time I will persist and remove this problem; will provide an update tomorrow. – user3812887 Oct 12 '15 at 13:53
  • Hello Mark, I have posted in the Firebird Support Mailing list already. I have forwarded the email conversations that I had to your email. As I said, when I was about to sit and solve this issue, the problem disappeared temporarily!!!! – user3812887 Oct 12 '15 at 13:56
  • Mark won't be notified of your comment here. Use "@" (for example "@MarkRotteveel") for this. :) – Val Marinov Oct 12 '15 at 14:23
  • @Mark,@ValMarinov : This is what I have in the Firebird DB: ------------------------------------------------------------------------------DECLARE EXTERNAL FUNCTION LTRIM CSTRING(1000) RETURNS CSTRING(1000) ENTRY_POINT 'lTrim' MODULE_NAME 'UDF'; -------------------------------------------------------------------------------------- DECLARE EXTERNAL FUNCTION LRTRIM CSTRING(1000) RETURNS CSTRING(1000) ENTRY_POINT 'lrTrim' MODULE_NAME 'UDF'; – user3812887 Oct 13 '15 at 04:57
  • In the firebird.conf file, I find #UdfAccess = Restrict UDF (the # sign is present) ( in both C:\Program Files\Firebird\Firebird_2_5 and C:\Program Files (x86)\Firebird\Firebird_2_5 ) – user3812887 Oct 13 '15 at 05:09
  • Now I found something that I did not notice so far: In the 32-bit folder: C:\Program Files (x86)\Firebird\Firebird_2_5\udf , I find these files: fbudf.dll,fbudf.sql,fbudf.txt,ib_udf.dll,ib_udf.sql,ib_udf2.sql,udf.dll,UDFPricing.dll ; Now in the 64-bit folder: C:\Program Files\Firebird\Firebird_2_5\UDF , I find these files: fbudf.dll,fbudf.sql,fbudf.txt,ib_udf.dll,ib_udf.sql,ib_udf2.sql (I do NOT find the last 2 .dll files - udf.dll and UDFPricing.dll - that are present in the 32-bit folder) – user3812887 Oct 13 '15 at 05:31
  • i.e. 8 files in the 32-bit folder, while only 6 files in the 64-bit folder; 2 missing files are - udf.dll and UDFPricing.dll (as I mentioned already, I need both 32-bit as well as 64-bit due to complexities of Microsoft SSRS connections) – user3812887 Oct 13 '15 at 05:38
  • No you, don't need both a 32 bit server and a 64 bit server. You only need a 32 bit server+client and 64 bit client, which we also told you last time! As you seem to only have the 32 bit udf.dll, you should remove the 64 bit Firebird **server**, keep the 32 bit server+client and, if necessary install the 64 bit client components. – Mark Rotteveel Oct 13 '15 at 05:57

2 Answers2

3

In your current setup you seem to have two Firebird servers

  1. a 32-bit in C:\Program Files (x86)\Firebird\Firebird_2_5,
  2. a 64 bit in C:\Program Files\Firebird\Firebird_2_5

Your UDF declaration points to module UDF, which is not a standard UDF, so this is most likely provided by your client to use with their database. You only have the libraries for these UDF in the 32 bit server installation, this means that you can only use the 32 bit server. Under some unknown conditions, you switch between the 32 bit and 64 bit server, meaning that subsequent connections are made to the 64 bit server, which doesn't have the required UDF which then leads to the error. You should uninstall the 64 bit server so this can't happen.

You comment that you need both because of SRSS, but that isn't the case. You only need one Firebird server (32 bit or 64 bit; in this case 32 bit because of the UDF), and the client libraries (32 bit and 64 bit) for your applications.

So what you need to do:

  1. Uninstall the 64 bit Firebird server,
  2. Start the 64 bit Firebird installer and install only the client components.

And finally double check the connection strings or connection properties to ensure that you are always connecting to the same server (host & port), and that you aren't accidentally using an embedded connection.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • Makes some good sense Mark; I really didn't get the Server+Client jargon; today, my colleague also suggested something along these lines.I will get back, thanks very much. In the mean time, I have sent another email to the Firebird Support Group, providing the definitions of the UDFs. I think you might have just seen that as well. – user3812887 Oct 13 '15 at 07:00
  • @user3812887 The server is what opens the database file and provides access to the database to clients, the client is dynamically linked into the application and talks to the server (usually through the wire protocol) on behalf of the application. – Mark Rotteveel Oct 13 '15 at 07:07
  • alternately, can I not add udf.dll in the 64-bit server UDF folder? will this be the same as the solution you provided ? Just to know whether this will also be possible – user3812887 Oct 13 '15 at 07:12
  • @user3812887 No, you can't use a 32 bit DLL with a 64 bit application. If you want to do that, you would need to ask your client if they also have a 64 bit DLL for these UDFs. – Mark Rotteveel Oct 13 '15 at 07:24
  • Is there any link you can provide me to install just the Firebird 2.5 64-bit client alone? I just don't want to download from unknown websites. – user3812887 Oct 13 '15 at 07:31
  • +1 Тhis is the answer. @user3812887 Run the installation program, just as though you were going to install the server – but select the CLIENT ONLY option from the install menu. – Val Marinov Oct 13 '15 at 07:44
  • @user3812887 In the normal Firebird installer there is an option to install the client components only. – Mark Rotteveel Oct 13 '15 at 07:55
  • and is there a way during run time to check the server I am connected to from IB Expert ? 32-bit or 64-bit – user3812887 Oct 13 '15 at 08:25
  • @Mark : Thanks, atlast !!!!!!!!!!! I followed the processes - fully uninstalled the 64-bit Firebird, and then reinstalled the same only with the minimum client components , while keeping the 32-bit Firebird untouched; now I am not getting the LTRIM,LRTRIM,RTRIM errors! now just one more question, from the IBExpert - during database registration - the Client Library File - should it be gds32.dll or C:\Program Files (x86)\Firebird\Firebird_2_5\bin\fbclient.dll ? – user3812887 Oct 13 '15 at 09:54
  • will they make a difference ? the gds32.dll was there earlier before the unstallation; my colleague suggested that I should use the 32-bit fbclient only. does it make a difference, as to which Client Library File is accessed from IB Expert ? – user3812887 Oct 13 '15 at 09:59
  • @user3812887 gds32.dll is provided for compatibility with applications expecting Interbase. It is basically the same as fbclient.dll. If you need it depends on whether IBExpert (which I don't use) loads fbclient.dll or not. Note that _"use the 32-bit fbclient only"_ doesn't make sense: you need a 64 bit dll, if you use a 64 bit application. – Mark Rotteveel Oct 13 '15 at 10:44
  • As far as IBExpert is concerned, it uses the 32-bit fbclient; IBExpert does not allow me to connect to a 64-bit client - it will fail saying that IBExpert is a 32-bit application; I use a 64-bit client only to connect to Microsoft SSRS Report Manager, using an ODBC connection. – user3812887 Oct 13 '15 at 11:50
  • To me, IBExpert is one thing, just to query the XYZ.fdb database; to develop reports in a web browser from the same database, I use the 64-bit client (64-bit fbclient.dll) – user3812887 Oct 13 '15 at 11:51
  • @Mark, So, you mean to say finally that gds32.dll and fbclient.dll (32-bit) are the same, right ? I don't want to get another LRTRIM error!! it has taken nearly 75 days to get a permanent solution for this - that is why I am double checking every minute detail – user3812887 Oct 13 '15 at 11:55
0

To me the solution was:

  1. Go to default Firebird directory installation (generally in C:\Program Files\Firebird\Firebird_3_0);
  2. Open the file firebird.conf in Notepad;
  3. Search for the parameter UdfAccess;
  4. Comment the line using the caracter # (hashtag) before the parameter name (#UdfAccess);
  5. In Windows Search Box type services.msc;
  6. Find the Firebird service;
  7. Click on Firebird service using the mouse right button;
  8. Choose Stop;
  9. Click on Firebird service using the mouse right button;
  10. Choose Start.
Patrick
  • 5,526
  • 14
  • 64
  • 101