How to get Database "java.sql.Connection" in a java step from an existing Database instance
I needed to write a very custom java.sql.PreparedStatement in a java step and the only missing piece is the "java.sql.Connection" object. Is there any Pega Engine API that will get this java object assuming I have the Database name and/or JDBC URL. Also, I have tried the following it works but I do not want to hardcode the password.
//Works but I don't want to hardcode the password
java.sql.Connection con = java.sql.DriverManager.getConnection("jdbc:oracle:thin:@dev.mycompany.com:8091:DEV", "username", "password");
//Note: getConnection("jdbc:url") signature does not work since password is require to get the instance
Thanks for the reply, I've look into the API and was able to get simple SQL execution working with executeRDB but what I need to do is to set a BLOB column to an external database. The code I currently have is something like below and everything will work except I don't want to hardcode the password. For executeRDB how do I pass in byte ?
Here's some code I created for one of my tools. This code does alot more than you need, but the part that hopefully is of interest to you is the construct that inserts the class. That's the part that avoids specifying the username and password.
// We need to use an RDB Execute, so that we are sure that the update date time
// we read is from the database and not the deferred list.
boolean debugFlag = false; // don't forget to falsify this before ship !
} else if (debugFlag) pega_rules_utilities.sendDebugMessageToTracer ("Staleness detected on column but ignoring it so we can check blob: column stamp = " + DBUpdateTime.toDate() + " step page stamp = " + ThisUpdateTime.toDate(), "Pega-ProCom");