Author Message
DmitrySenashenko3
Joined: Aug 28, 2019
Messages: 62
Offline
Hello all,
I have a question about subj.
I mean you know connection to DB is hardcoded at App properties.
I need to do it configurable somehow.
It means IP of DB, database, login, password should be from config file or from configurable variables.
But I can't find at sources where I can replace hardcoded info by info from config.
Could somebody push me to right direction?
Thanks a lot.
Rg, Dmitry
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
For Tomcat the DB connection is stored in 2 different file. The context.xml or catalina/localhost/<application>.xml has the connection url and jdbc classpath information and the web.xml has user name and encrypted password. If you need to change the password, you would have to go to the OD Eclipse Preferences screen Avay->Orchestration Designer->Password Encryption to convert the password and paste it in the web.xml.
DmitrySenashenko3
Joined: Aug 28, 2019
Messages: 62
Offline
Hello,
Thank you for your answer.
But I asked other question.
How to change login and password manually from application?
For example how to change login and password to DB by configurable variables from web portal of Experience portal?

I see now just the way to develop clear java code with JDBC connector. Is there way to do this in Orchestration Designer framework?

Best regards, Dmitry
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
I guess you mean you want to be able to configure the db connection in code. While I don't recommend you to do that since this does not allow you to take advantage of connection pool for performance on app servers, I can show you how to do that in code below:

In the database operation java class constructor method generated by OD:

//}}END:CLASS:CONSTRUCTOR

ConnectionProperties connProps = new ConnectionProperties();
connProps.setDriver("<driver>");
connProps.setUrl("<url>");
connProps.setUser("<user>");
connProps.setPassword("<password>");

setConnectionProperties(connProps);

You can get each of the property value from the variables.
DmitrySenashenko3
Joined: Aug 28, 2019
Messages: 62
Offline
Thank you very much WilsonYu. It is what I wanted.

Best regards, Dmitry
Go to:   
Mobile view