I have created a Teradata Java UDF and want to send some environment variable to teradata UDF process. I tried the following.
1. Created newsettings.txt file with below content
2. Created /tmp/udfenv.txt with required environment variables
3. Applied the changes using cufconfig utility
cufconfig -f /tmp/newsettings.txt
4. Restarted the database.
But I cannot see these environment variables at run time. I set the debug point in java code and checked that environment variables are not passed to UDF process. Please suggest a way to send the environment variables to teradata UDF process.
I also tried using CLIEnvFile, JavaEnvFile of cufconfig fields but no luck.
It appears to me from the documentation that the UDF... fields in cufconfig are not accessible directly from UDFs but are used to compile them. The CLIEnvFile is for XSPs, not UDFs, and I suspect the same is true for JavaEnvFile. I think you might need to use GLOP to do what you want - it is the means that was intended for sharing data among UDF instances. Check out Chapter 8 in the SQL External Routine Programming manual.
Thank you for responding.
My requirement is not to share data among UDF instances. We are using third party native libraries (.so files) in our java UDF. So we need to set LD_LIBRARY_PATH so that .so files dependencies will be resolved. Also the third party libraries excepts some environment variable to be set. So I need to send environment variables only to the UDF process.
I tried setting the environment variables permanently at OS level, but still the environment variables are not visible in UDF process.
Search docs.teradata.com for cufconfig and UIFLibraryPath. The cufconfig can be set for many of the sorts of things you are looking for. For a C UDF you can certainly set the UDFLibPath and UDFEnvFile which likely do what you are after for C UDFs. For Java UDFs there is a similar setting for JavaEnvFile which would handle environment variables. If I recall correctly, the file that this identitifies must reside on every TPA node for this to work. I do not know if the JavaLibraryPath can work for .so files as it was designed for jar files. Possibly the LD_LIBRARY can be an environment variable in this case?
I have tried with multiple fileds from cufconfig (UDFEnvFile, JavaEnvFile, CLIEnvFile, UDFLibPath, JavaLibraryPath, UDFLibraryPath, CLILibPath, CLILibraryPath) to set environment varibales and to resolve .so dependencies. But none of them worked.
I tried myself and it does not seem to be working. I had someone verify there is code to support the feature. Not sure what is the problem as yet.
Thank you for checking on this. Please keep me posted if you find the solution or root cause. We are blocked at this point and not sure on the next steps to resolve the issue. We almost tried with all the cufconfig fields as mentioned in teradata documentation.
At this point I think you need to open an incident. It sounds like there is something that needs to be fixed.