Author Message
MCDeveloper
Joined: Jun 29, 2015
Messages: 66
Offline
Hello,
I have a Datasource that needs frequent changes of password. So, I have decided to set the password with its encrypted value from AEP configurable variables on my app.
I am looking for the code to add to each DB operation to override the user and password. Which is the method name and how can I override those params?

Thanks you very much in advance!
Regards
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
Currently there is no way to support dynamic user and password while database connection pool is used. But there is a way to configure the database connection with all the necessary properties - driver, url, user and password - dynamically. Connection pool is not used in this case, which may impact the app negatively in performance. It depends on how heavily is db being used.

To dynamically configure the connection, you can use code like the following in dbop java class constructor:


// }}END:CLASS:CONSTRUCTOR
IVariableField user = mySession.getVariableField(new VariableName("uservar"));
IVariableField pass = mySession.getVariableField(new VariableName("passvar"));

Database.ConnectionProperties props = new Database.ConnectionProperties();
props.setDriver("com.microsoft.sqlserver.jdbc.SQLServerDriver");
props.setUrl("jdbc:sqlserver://1.2.3.4;databasename=test");
props.setUser(user);
props.setPassword(pass);

setConnectionProperties(props);
}
RossGunn
Joined: Jun 14, 2016
Messages: 1
Offline
Does the password in this method still go through the built-in OD encryption or is it plain text? I'm thinking plain text.

Thanks, Ross (the newbie, not the 5 star guy)
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
Plain text.
Good to know there is another Ross :)
Go to:   
Mobile view