Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Exception raised when Informix function encrypt_aes called


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 3 - Last Post: Sep 9, 2014 8:59 PM Last Post By: Dmitry Arefiev
Paulo Mariano

Posts: 29
Registered: 11/25/12
Exception raised when Informix function encrypt_aes called  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 25, 2014 3:23 PM
Hello.

A couple of weeks ago, I posted a question about an issue with FireDAC and the Informix function encrypt_aes. The question can no longer be found after the site maintenance ended on 08/20/2014:
https://forums.embarcadero.com/thread.jspa?threadID=108366&stqc=true

So, I am posting the question again, this time with a few more details.

In an application developed with Delphi XE5, the following statement is executed after the connection to the Informix database is established:
STATEMENT A
eQuery.SQL.Text := Format('set encryption password "%s"', [s1]);
eQuery.ExecSQL;


This statement is required to set the password to be used by Informix function encrypt_aes:
http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.sqls.doc/sqls1027.htm

When the application inserts a row into a given table (STATEMENT B), the insert trigger is fired.
In the insert trigger, user-defined function encrypt_nopw is called, which then calls the Informix function encrypt_aes:
CREATE FUNCTION encrypt_nopw(info CHAR(50)) returning char(100);
  return encrypt_aes(info);
END FUNCTION;


Everything works correctly.

After converting the application from Delphi XE5 to Delphi XE6, the following exception is raised when STATEMENT B is executed:
Project app.exe raised exception class EInfxNativeException with message
[FireDAC][Phys][ODBC][Informix][Informix ODBC Driver][Informix] The encryption/decryption password is not set

The exception is raised because, for some reason, the password set by STATEMENT A is ignored.

One possible workaround is the execution of STATEMENT A just before the execution of any statement that will invoke the Informix function encrypt_aes.
Considering that the application works when built with Delphi XE5, what should be done in the Delphi XE6 version to fix the problem and eliminate the extra STATEMENT A calls?

Thank you in advance.
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: Exception raised when Informix function encrypt_aes called  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 29, 2014 3:53 AM   in response to: Paulo Mariano in response to: Paulo Mariano
Try the following:
1) Specify ODBCAdvanced=CURB=0 in your connection parameters.
2) Try to set ResourceOptions.DirectExecute to True.

--
With best regards,
Dmitry Arefiev / FireDAC Architect
Paulo Mariano

Posts: 29
Registered: 11/25/12
Re: Exception raised when Informix function encrypt_aes called  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 8, 2014 1:21 PM   in response to: Dmitry Arefiev in response to: Dmitry Arefiev
Hello, Dmitry.

Thank you for your reply.

Although the following statements have been added to the application:
Params.Values['ODBCAdvanced'] := '0';
Params.Values['CURB'] := '0';
...
FDConnection.ResourceOptions.DirectExecute:= True;


the problem has not been solved.
Is there anything else I could try?

Thank you again.
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: Exception raised when Informix function encrypt_aes called  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 9, 2014 8:59 PM   in response to: Paulo Mariano in response to: Paulo Mariano
The correct ODBCAdvanced usage is:
Params.Values['ODBCAdvanced'] := 'CURB=0';
...
FDConnection.ResourceOptions.DirectExecute:= True;


--
With best regards,
Dmitry Arefiev / FireDAC Architect
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02