I was working in an environment where we had multiple data sources in weblogic and we wanted to move these data sources from Dev environment to Stage environment. If we create these data sources manually then it would be time consuming and so many clicks, We can use APIs though. Anyways here are the steps which I followed:
Copied the data sources XMLs from/config/jdbc to /config/jdbc
Modified the/config/config.xml to add the entries of these data sources. It would be similar to below snippet (You can copy it from /config/config.xml):
STAGE_CLUSTER: It's cluster name (target for data source)
Above command will return you encrypted string for password, paste the encrypted string in XMLs
Copied the data sources XMLs from
Modified the
STAGE_CLUSTER: It's cluster name (target for data source)
Modified the "XML File Name 1" and "XML File Name 2" to have the Stage JDBC URL, UserName, Password.
Note:
You'll face issue while modifying the password in XML files because it would be in encrypted format.
If you do not change password in XML file, weblogic will not allow you to reset the password from UI as well.
Solution:
Go to Domain Directory and execute setDomainEnv.sh/cmd
Execute below command:
java -cp /server/lib/weblogic.jar:$CLASSPATH
weblogic.security.Encrypt
Restart your server