R UDX Troubleshooting

Troubleshoot R UDX issues.

A general error is returned by the UDX framework if a UDX cannot be run at all or if it completes with an error:
SQL1646N A routine failed because the fenced user ID cannot access required files in the sqllib directory or other instance or database directories.
Possible reasons:
  • DBM config setting R_PATH is not set
  • Environment variable $DB2_HOME is not set (for fenced user id)
  • Coding error in the UDX (e.g. an R syntax error)
Steps to resolve:
  • Specify a log file for the fenced user and check the output there (might require Db2 restart): export DB2_RUDF_LOGFILE=<path_to_log_file>
  • Check if a simple sample UDX works.
  • Use logMessage() API in your routine code to log information to sqllib/db2dump/routinelog/routine.*.log
  • Example: logMessage(NZ.DEBUG, "This is my debug trace")
  • Alternatively (only if above instructions do not work or if a DB2 restart cannot be done) you can modify $DB2_HOME/adm/runr.sh to set the log file.