Building and deploying java UDRs
Posted in 2017
Topics: Installation, Setup & Upgrades, Connectivity: ODBC / JDBC / .NET, Java & JDBC Development
Not sure if this forums is the correct, but the other forums did not have much traffic, so here goes: What are the best practices for building and deploying java UDRs? We are a java shop, but up until now we have not used java for UDRs. I did a quick shot at it, and got it to work after some fiddling. However, we normally use maven for building java stuff, and I can't find the krakatoa.jar in any public maven repository. The jdbc driver was released to a repository fairly recently (hooray!), but for the krakatoa.jar I have to take that from a server installation, and deploy in our internal repo. Is that the way to go? How is this normally handled?
Hi Oyvind, AFAIK, krakatoa is not a public library, which would explain why you can't find it anywhere else than in the IDS binary distribution. Generally when one develops Java UDRs, he does it on the box where the informix server binaries are (can be obviously just the binaries, even if not running a real IDS instance). Sooner or later, the UDR will need to be linked to the instance because it will be part of the instance's UDRs. Let's listen to what the R&D or offering management guys will say. Eric
Hi there!
Let me try to help you on that issue:
1 - You must have a SBSpace set on SBSPACENAME and SYSSBSPACENAME
configuration parameter (requires bounce)
2 - You must have a JVP VP CLASS - "onmode p +1 jvp" to enable it online or
set it on instance's configuration file and bounce it
3 - select the database you want to use this JAVA function, and execute the
following steps:
-- publishing the .jar file which has the function - Referencing as md5 the
"Criptografia.md5" class
EXECUTE PROCEDURE
sqlj.install_jar('file:$INFORMIXDIR/lib/talend-utils-1.00.00.jar', 'md5',0);
-- Creating the informix function:
CREATE FUNCTION getmd5(CHAR(50))
RETURNS CHAR(50)
WITH (class='jvp')EXTERNAL NAME 'md5:br.xxxxx.talend.utils.Criptografia.md5'
LANGUAGE JAVA;
-- Granting execution permission
GRANT EXECUTE ON FUNCTION getmd5(CHAR(50)) TO ALL;
Using the function:
select first 10 user_id, getmd5(user_id)as masked_user_id from mytable;
user_id 00012547000030950025
masked_user_id f3c750dcb75be4691c2066840808404c
user_id 0300059781000117
masked_user_id a2d9a91a32838942963c1449498be5c
user_id 0300059781000117
masked_user_id a2d9a91a32838942963c1449498be5c
user_id 7100050500025001
masked_user_id 3f7f893bd1e24e46457a14dc2ecb6b28
user_id 00034939000151870014
masked_user_id ff94b52886d91966eabfad8d3ed974a8
user_id 836499100027015
masked_user_id cde73210d3dec16ba1f4917e7c4960f7
user_id 836499100027015
masked_user_id cde73210d3dec16ba1f4917e7c4960f7
user_id 952180151734013
masked_user_id baff740e349c7dff9a4ab908cbe80736
user_id 1101703228108030
masked_user_id 61d17376cf767dfee61d740605d835be
user_id 00012548000002440013
masked_user_id f74e129a1c63ba0c35a840944fc1801e
10 row(s) retrieved.
That's it!
regards,
Alberto Pessonio.