Hi All,
We have seen many demonstrations of reading a properties file inside a WLST script to make is fully automated and easily managable without Hardcoding anything inside it. We will see many demos of creating and configuring various resources in WebLogic Server using the WLST where we used properties file data as an input to the resource configuration. Here is an example in which we will see How to Configure WebLogic DataSource using WLST?
In this sample we will use a properties file to avoid hard coding. This script will be same for various DataSource configuration just we need to change the Properties files entry to make a new DataSource.
Step1). Create a Directory somewhere in your file system like: “C:WLST_DS_Creation” and place a properties file like below in this directory with name “details.properties”
domain.name=7001_Domain admin.url=t3://localhost:7001 admin.userName=weblogic admin.password=weblogic datasource.name=DS_One datasource.database.name=demo datasource.target=AdminServer datasource.filename=DS_One.xml datasource.jndiname=DS_One_JNDI datasource.driver.class=com.pointbase.jdbc.jdbcUniversalDriver datasource.url=jdbc:pointbase:server://localhost:9092/demo datasource.username=PBPUBLIC datasource.password=PBPUBLIC datasource.test.query=SQL SELECT * FROM DUAL
Step2). Now in the same directory write the following WLST Script “createDataSource.py” like following:
from java.io import FileInputStream propInputStream = FileInputStream("details.properties") configProps = Properties() configProps.load(propInputStream) domainName=configProps.get("domain.name") adminURL=configProps.get("admin.url") adminUserName=configProps.get("admin.userName") adminPassword=configProps.get("admin.password") dsName=configProps.get("datasource.name") dsFileName=configProps.get("datasource.filename") dsDatabaseName=configProps.get("datasource.database.name") datasourceTarget=configProps.get("datasource.target") dsJNDIName=configProps.get("datasource.jndiname") dsDriverName=configProps.get("datasource.driver.class") dsURL=configProps.get("datasource.url") dsUserName=configProps.get("datasource.username") dsPassword=configProps.get("datasource.password") dsTestQuery=configProps.get("datasource.test.query") connect(adminUserName, adminPassword, adminURL) edit() startEdit() cd('/') cmo.createJDBCSystemResource(dsName) cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName) cmo.setName(dsName) cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDataSourceParams/' + dsName ) set('JNDINames',jarray.array([String('jdbc/' + dsName )], String)) cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName ) cmo.setUrl(dsURL) cmo.setDriverName( dsDriverName ) cmo.setPassword(dsPassword) cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCConnectionPoolParams/' + dsName ) cmo.setTestTableName(dsTestQuery) cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName + '/Properties/' + dsName ) cmo.createProperty('user') cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName + '/Properties/' + dsName + '/Properties/user') cmo.setValue(dsUserName) cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName + '/Properties/' + dsName ) cmo.createProperty('databaseName') cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName + '/Properties/' + dsName + '/Properties/databaseName') cmo.setValue(dsDatabaseName) cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDataSourceParams/' + dsName ) cmo.setGlobalTransactionsProtocol('OnePhaseCommit') cd('/SystemResources/' + dsName ) set('Targets',jarray.array([ObjectName('com.bea:Name=' + datasourceTarget + ',Type=Server')], ObjectName)) save() activate()
Step3). Now Open a Command/Shell Prompt and then run the “setWLSEnv.sh” script to set the CLASSPATH and PATH environment variables. Run the “. ./setWLSEnv.sh” by adding two DOTs separated by a single space …..before the actual script like following : (use ‘cd’ command to move inside the <BEA_HOME>/wlserver_10.3/server/bin) then run the following command….
. ./setWLSEnv.sh
Note: Here The first DOT represents that set the Environment in the current Shell, AND the second ./ represents execute the script from the current directory.
Step4). Run the Above WLST Script like following:
java weblogic.WLST createDataSource.py
Make sure that the Database is running while you are creating the DataSource.
.
.
Thanks
Jay SenSharma
February 13th, 2011 on 1:20 am
I used below properties file…to create a datasource by sing WLST on Mysql Database….but getting some error…
i tested by using the dbping utility, it is done successful. i used even database jar file in CLASSPATH.
domain.name=pal_domain
admin.url=t3://10.98.98.4:7001
admin.userName=weblogic
admin.password=weblogic
datasource.name=DS_One
datasource.database.name=pal
datasource.target=AdminServer
datasource.filename=DS_One.xml
datasource.jndiname=DS_One_JNDI
datasource.driver.class=com.mysql.jdbc.Driver
datasource.url=jdbc:mysql://localhost:3306/pal
datasource.username=root
datasource.password=root
For more help, use help(edit)
Starting an edit session …
Started edit session, please be sure to save and activate your
changes once you are done.
Saving all your changes …
Saved all your changes successfully.
Activating all your changes, this may take a while …
The edit lock associated with this edit session is released
once the activation is completed.
This Exception occurred at Sat Feb 12 19:58:24 UTC 2011.
weblogic.application.ModuleException:
at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:289)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:42)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
at weblogic.application.internal.SingleModuleDeployment.prepare(SingleModuleDeployment.java:16)
.
.
.
.
.
.
.
.
.
at weblogic.deploy.service.internal.statemachines.targetserver.AwaitingContextUpdateCompletion.contextUpdated(AwaitingContextUpdateCompletion.java:32)
at weblogic.deploy.service.internal.targetserver.TargetDeploymentService.notifyContextUpdated(TargetDeploymentService.java:225)
at weblogic.deploy.service.internal.DeploymentService$1.run(DeploymentService.java:189)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: weblogic.common.ResourceException: weblogic.common.ResourceException: Could not create pool connection. The DBMS driver exception was: Access denied for user ‘root’@’localhost’ (using password: YES)
at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:253)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1109)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1033)
at weblogic.common.resourcepool.ResourcePoolImpl.start(ResourcePoolImpl.java:214)
at weblogic.jdbc.common.internal.ConnectionPool.doStart(ConnectionPool.java:1051)
at weblogic.jdbc.common.internal.ConnectionPool.start(ConnectionPool.java:146)
at weblogic.jdbc.common.internal.ConnectionPoolManager.createAndStartPool(ConnectionPoolManager.java:385)
at weblogic.jdbc.common.internal.ConnectionPoolManager.createAndStartPool(ConnectionPoolManager.java:326)
at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:251)
Problem invoking WLST – Traceback (innermost last):
File “/JavaPreparation/WLST/JDBCDataSource/createDataSource.py”, line 59, in ?
File “”, line 364, in activate
WLSTException: Error occured while performing activate : Error while Activating changes. Use dumpStack() to view the full stacktrace
February 13th, 2011 on 1:24 am
please gothrough the above error
Thank you:
Hemanth kumar
February 13th, 2011 on 1:41 am
hi jay…
I even tried your post “Debugging Basic JDBC Issues”…but no use same error is coming.
Thank you,
Hemanth kumar
February 13th, 2011 on 5:15 pm
Hi Hemanth,
MySQL has a default feature that by default it won’t allow to access the MySQL from a remote Box, It can be accessed only from “localhost” box.
But if you want to access MySQL from a remote Box then you need two users one root@% which can access from any machine and root@localhost to access from localhost .
So you will have to make a User “root@%” so that you can access mysql from a remote Box as well…For more information please search String “Access denied for user ‘root’@’localhost’ (using password: YES)” in the below link to get how to configure MySQL:
http://dev.mysql.com/doc/refman/5.1/en/access-denied.html
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
February 14th, 2011 on 12:20 am
Yes…i did it…Thank you very much for your reply
Hemanth kumar
February 20th, 2011 on 12:17 pm
I am using this script and the data source gets created. But the password that I provide in perperties file that is aa0d (0 is digit zero here), it gives me this error during script running when it acctivates and also on the ui during activation
Caused by: weblogic.common.resourcepool.ResourceSystemException:
Could not connect to ‘oracle.jdbc.OracleDriver’.
The returned message is: ORA-01017: invalid username/password; logon denied
It is likely that the login or password is not valid.
It is also possible that something else is invalid in
the configuration or that the database is not available.
at weblogic.jdbc.common.internal.JDBCUtil.parseException(JDBCUtil.java:301)
at weblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(ConnectionEnvFactory.java:374)
at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:236)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1249)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1166)
at weblogic.common.resourcepool.ResourcePoolImpl.start(ResourcePoolImpl.java:249)
at weblogic.jdbc.common.internal.ConnectionPool.doStart(ConnectionPool.java:1154)
at weblogic.jdbc.common.internal.ConnectionPool.start(ConnectionPool.java:154)
at weblogic.jdbc.common.internal.ConnectionPoolManager.createAndStartPool(ConnectionPoolManager.java:454)
at weblogic.jdbc.common.internal.ConnectionPoolManager.createAndStartPool(ConnectionPoolManager.java:372)
at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:255)
Problem invoking WLST – Traceback (innermost last):
File “/admin/Oracle/Middleware/user_projects/domains/base_domain/scripts/createDataSource.py”, line 59, in ?
File “”, line 376, in activate
File “”, line 1848, in raiseWLSTException
WLSTException: Error occured while performing activate : Error while Activating changes. :
Use dumpStack() to view the full stacktrace
February 20th, 2011 on 12:44 pm
Hi,
Please correct the line 31 in the above script ….(i just now corrected it)
The original 31st line was: cmo.setPassword(dsUserName)
Please change it to : cmo.setPassword(dsPassword)
Above WLST worked for me because when i tested it …that time for my Database the username/password both were same. So i assigned the same variable to the username as well as for password. Sorry for confusion.
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
February 20th, 2011 on 12:24 pm
In the script I think line 26 is wrong
cd(‘/JDBCSystemResources/’ + dsName + ‘/JDBCResource/’ + dsName + ‘/JDBCDriverParams/’ + dsName )
34
cmo.setUrl(dsURL)
35
cmo.setDriverName( dsDriverName )
36
cmo.setPassword(dsUserName)
February 20th, 2011 on 12:48 pm
Hi Testab,
Thanks for pointing the mistake in the Script. Keep updating us 🙂
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
February 24th, 2011 on 5:23 am
Hi,
Before creating the user how can I check if the user exists or not and throw a message accordingly?
February 24th, 2011 on 11:09 pm
Hi testab,
Until the DataSource is created you will not get a chance to Test the Connection. While testing the Jdbc Connection retrieved from the Pool only u will get to know about the Username is correct or not.
In above post we are just creating DataSource. So u will have to make sure that the user exist and the user information is provided by the Database team.
Once the DataSource is created you can check the connections …if the credentials are wrong then Database will throw an error.
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
February 25th, 2011 on 3:16 am
sorry this is a wrong place where i posted. I was ot talking about database or datasource. I mean creating weblogic user. I will post it correctly in that thread.
Thanks
Anup
February 26th, 2011 on 4:09 am
I am wanting to write a script (WLST) to set up a large initial set of credential mappings on a JDBC data source.
I can create the datasource and do all the basic set ups, but I can’t figure out how to do the credential mappings.
I tried the “record” option from the Admin console, but it created a script that says that credential mappings are not recorded.
This is the mapping function that you get to from the “Security” tab on the DataSource page, and then the “Credential Mappings” tab. This allows you to map a “WLS user” to a “remote user” – which in my case is an Oracle OLS user.
I am using Weblogic 10.3
Can anyone point me to a set of commands which can perform this function?
Thanks!
March 24th, 2011 on 8:15 pm
Hi jay,
I want to know how can we use this property file and script to create more than 1 datasource, I am trying to create nearly 10-12 datasource as per my project requirement.
March 24th, 2011 on 9:41 pm
Hi Kaushik,
Your wish is granted… 😉 I have just created a script which would fulfil your requirement , have fun.
Topic: Creating Multiple DataSource Using WLST with Properties File
Regards,
Ravish Mody
February 16th, 2012 on 3:46 am
Hello JaySenSharma & Ravish Mody:
I know have been passed a lot of time since you posted in this entry, but now I’m trying to create a data source using your code and I’m getting errors. I’m using Oracle Weblogic Server 10.3.5 and Oracle Database 11g.
my .properties file looks like this:
domain.name=test_domain
admin.url=t3://infap56-pc:7001
admin.userName=weblogic
admin.password=welcome1
total.DS=1
datasource.name=testDS
datasource.database.name=afis
datasource.target=AdminServer
datasource.filename=testDS.xml
datasource.jndiname=testDS
datasource.driver.class=oracle.jdbc.xa.client.OracleXADataSource
datasource.url=jdbc:oracle:thin:@10.9.4.152:1521:afis
datasource.username=fichaje
datasource.password=fichaje
datasource.test.query=SQL SELECT * FROM DUAL
I’ve copied and pasted the createDataSource.py file.
When I execute the java weblogic.WLST createDataSource.py from my command I get the folloing error:
C:WLST_DS>java weblogic.WLST createDataSource.py
Initializing WebLogic Scripting Tool (WLST) …
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Connecting to t3://infap56-pc:7001 with userid weblogic …
Successfully connected to Admin Server ‘AdminServer’ that belongs to domain ‘tes
t_domain’.
Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.
Location changed to edit tree. This is a writable tree with
DomainMBean as the root. To make changes you will need to start
an edit session via startEdit().
For more help, use help(edit)
You already have an edit session in progress and hence WLST will
continue with your edit session.
Starting an edit session …
Started edit session, please be sure to save and activate your
changes once you are done.
No stack trace available.
Problem invoking WLST – Traceback (innermost last):
File “C:WLST_DScreateDataSource.py”, line 28, in ?
File “”, line 182, in cd
File “”, line 1848, in raiseWLSTException
WLSTException: Error cding to the MBean
Any idea?
Regards,
Isabel Bernely
April 27th, 2012 on 6:39 pm
Hi,
I tried to create a datasource with the procedure given by Jay SenSharma.
But I am getting below error.
Connecting to t3://localhost:7001 with userid weblogic …
This Exception occurred at Fri Apr 27 16:24:39 GMT+05:30 2012.
javax.naming.AuthenticationException [Root exception is java.lang.SecurityExcept
ion: User: weblogic , failed to be authenticated.]
at weblogic.jndi.internal.ExceptionTranslator.toNamingException(Exceptio
nTranslator.java:42)
at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLIni
tialContextFactoryDelegate.java:788)
at weblogic.jndi.WLInitialContextFactoryDelegate.pushSubject(WLInitialCo
ntextFactoryDelegate.java:682)
Can anyone help ?
I have given correct credentials in the details.properties file.
July 20th, 2012 on 5:26 pm
Hi,
I need to get the list of datasource and its properties using WLST. Below is the script we wrote.
from java.io import FileInputStream
propInputStream = FileInputStream(“details.properties”)
configProps = Properties()
configProps.load(propInputStream)
domainName=configProps.get(“domain.name”)
adminURL=configProps.get(“admin.url”)
adminUserName=configProps.get(“admin.userName”)
adminPassword=configProps.get(“admin.password”)
dsName=configProps.get(“datasource.name”)
dsFileName=configProps.get(“datasource.filename”)
dsDatabaseName=configProps.get(“datasource.database.name”)
datasourceTarget=configProps.get(“datasource.target”)
dsJNDIName=configProps.get(“datasource.jndiname”)
dsDriverName=configProps.get(“datasource.driver.class”)
dsURL=configProps.get(“datasource.url”)
dsUserName=configProps.get(“datasource.username”)
dsPassword=configProps.get(“datasource.password”)
dsTestQuery=configProps.get(“datasource.test.query”)
connect(adminUserName, adminPassword, adminURL)
cd(‘/’)
cd(‘/JDBCSystemResources/’ + dsName + ‘/JDBCResource/’ + dsName)
cmo.getName()
By runnign the above script, nothing has been list out. Please find below the execution of script.
C:Users264232DesktopPOCWLSTDSQuery>java weblogic.WLST getDataSource.py
Initializing WebLogic Scripting Tool (WLST) …
Jython scans all the jar files it can find at first startup. Depending on the sy
stem, this process may take a few minutes to complete, and WLST may not return a
prompt right away.
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Connecting to t3://localhost:7001 with userid weblogic …
Successfully connected to Admin Server ‘AdminServer’ that belongs to domain ‘bas
e_domain’.
Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.
C:Users264232DesktopPOCWLSTDSQuery>
Can someone please help me in geting the list of datasource and its properties.
Thanks!
July 22nd, 2012 on 12:49 pm
You have to add print statements, for example,
print cmo.getName();
July 22nd, 2012 on 10:47 pm
Hi Rene,
Thanks for your reply.
I edited the query like this.
import sys
import java.lang
import string
from java.io import File
from java.io import FileOutputStream
dsName=configProps.get(‘datasource.name’)
connect(‘weblogic’,’weblogic1′,’t3://localhost:7001′)
servers = domainRuntimeService.getServerRuntimes();
cd(‘/’)
cd(‘/JDBCSystemResources/’ + dsName + ‘/JDBCResource/’ + dsName)
dsName=configProps.get(“datasource.name”)
cmo.getName()
print cmo.getName();
By executing that I am getting the below error.
C:Users264232DesktopPOCWLSTDSQuery>java weblogic.WLST getDataSource.py
Initializing WebLogic Scripting Tool (WLST) …
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Problem invoking WLST – Traceback (innermost last):
File “C:Users264232DesktopPOCWLSTDSQuerygetDataSource.py”, line 6, in
?
NameError: configProps
adding to it If i removed “dsName=configProps.get(“datasource.name”)” it is saying that ?
NameError: dsName.
Can u please help me on this.
Thanks!
July 23rd, 2012 on 12:15 pm
In the example above Jay defined this to load properties:
propInputStream = FileInputStream(“details.properties”)
configProps = Properties()
configProps.load(propInputStream)
Looks from the error (NameError: configProps) you forgot to define configProps.
November 26th, 2012 on 6:09 pm
Hi
I wanted to create a security realm and set some properties.
May I know the methods available to do this.
Please point to APIs available in WLST
Thanks,
Pushkala
December 3rd, 2012 on 7:29 pm
Jay,
Great article!
I have followed your script, and datasource is created sucessufully, Next thing is how to create jndi for DB adaptor(eis/DB/hr) with the association of above data source created through script.
Really, it will be great help.
Thanks inadvance.
June 17th, 2013 on 1:39 pm
Hi Jay,
The above script works fine for me…:)
Now, in the above script, before creating the data source, I would like to have a check, that if the data source exists, then to skip the creation.
Thanks
June 25th, 2013 on 1:31 am
Hi Jay/Ravish,
I too have the similar situation.
How to check the existence of data source before creating.
Consider we are running this script in multiple managed servers, where some data sources are already present.
Thanks,
Raaju
November 6th, 2013 on 2:55 pm
Hi
I am getting below error when i am executing the .py file:-
wls:/offline> createDataSource.py
Traceback (innermost last):
File “”, line 1, in ?
NameError: createDataSource
wls:/offline>
November 14th, 2013 on 3:21 pm
Hi Rene/Jay/Ravish,
After executing the above script, I am getting the below error:
Starting an edit session …
Started edit session, please be sure to save and activate your
changes once you are done.
No stack trace available.
Problem invoking WLST – Traceback (innermost last):
File “/home/soadev/DS_Creation/createDatasource.py”, line 30, in ?
File “”, line 182, in cd
File “”, line 1847, in raiseWLSTException
WLSTException: Error cding to the MBean
I am getting this error in the line:
cd(‘/JDBCSystemResources/’ + dsName + ‘/JDBCResource/’ + dsName)
Please suggest.. My script is as below
*************************************************
configProps.load(propInputStream)
domainName=configProps.get(“domain.name”)
adminURL=configProps.get(“admin.url”)
adminUserName=configProps.get(“admin.userName”)
adminPassword=configProps.get(“admin.password”)
dsName=configProps.get(“datasource.name”)
dsFileName=configProps.get(“datasource.filename”)
dsDatabaseName=configProps.get(“datasource.database.name”)
datasourceTarget=configProps.get(“datasource.target”)
dsJNDIName=configProps.get(“datasource.jndiname”)
dsDriverName=configProps.get(“datasource.driver.class”)
dsURL=configProps.get(“datasource.url”)
dsUserName=configProps.get(“datasource.username”)
dsPassword=configProps.get(“datasource.password”)
dsTestQuery=configProps.get(“datasource.test.query”)
connect()
edit()
startEdit()
cd(‘/’)
cmo.createJDBCSystemResource(dsName)
cd(‘/JDBCSystemResources/’ + dsName + ‘/JDBCResource/’ + dsName)
cmo.setName(dsName)
cd(‘/JDBCSystemResources/’ + dsName + ‘/JDBCResource/’ + dsName + ‘/JDBCDataSourceParams/’ + dsName )
set(‘JNDINames’,jarray.array([String(‘jdbc/’ + dsName )], String))
cd(‘/JDBCSystemResources/’ + dsName + ‘/JDBCResource/’ + dsName + ‘/JDBCDriverParams/’ + dsName )
cmo.setUrl(dsURL)
cmo.setDriverName( dsDriverName )
cmo.setPassword(dsPassword)
cd(‘/JDBCSystemResources/’ + dsName + ‘/JDBCResource/’ + dsName + ‘/JDBCConnectionPoolParams/’ + dsName )
cmo.setTestTableName(dsTestQuery)
cd(‘/JDBCSystemResources/’ + dsName + ‘/JDBCResource/’ + dsName + ‘/JDBCDriverParams/’ + dsName + ‘/Properties/’ + dsName )
cmo.createProperty(‘user’)
cd(‘/JDBCSystemResources/’ + dsName + ‘/JDBCResource/’ + dsName + ‘/JDBCDriverParams/’ + dsName + ‘/Properties/’ + dsName + ‘/Properties/user’)
cmo.setValue(dsUserName)
cd(‘/JDBCSystemResources/’ + dsName + ‘/JDBCResource/’ + dsName + ‘/JDBCDriverParams/’ + dsName + ‘/Properties/’ + dsName )
cmo.createProperty(‘databaseName’)
cd(‘/JDBCSystemResources/’ + dsName + ‘/JDBCResource/’ + dsName + ‘/JDBCDriverParams/’ + dsName + ‘/Properties/’ + dsName + ‘/Properties/databaseName’)
cmo.setValue(dsDatabaseName)
cd(‘/JDBCSystemResources/’ + dsName + ‘/JDBCResource/’ + dsName + ‘/JDBCDataSourceParams/’ + dsName )
cmo.setGlobalTransactionsProtocol(‘OnePhaseCommit’)
cd(‘/SystemResources/’ + dsName )
set(‘Targets’,jarray.array([ObjectName(‘com.bea:Name=’ + datasourceTarget + ‘,Type=Server’)], ObjectName))
save()
activate()
**********************************************
May 7th, 2014 on 9:42 pm
Hi Jay, How can we use this script in Offline mode. I want to create data source along with the domain/servers/clusters script. But in this script we have to connect to the running WLS. Is it possible to make this work offline. Please let me us know how it can be done. Many Thanks, Harish.
May 8th, 2014 on 2:47 am
Hello Again Jay,
How can we target this data source to one or more servers and/or cluster instead of Admin Server as shown in this example.
I have 16 managed server they are in 5 different clusters. I need target the data source either to clusters or to the managed servers.
Many Thanks
Harish
May 29th, 2014 on 7:11 pm
I am a new bee to Weblogic and have got a question on datasources. I can see that the datasource can be created by WLST and it creates an xml file in the DOMAIN_HOME/config/jdbc. So the next time I need to update a datasource, will it work if I update the xml file under the folder jdbc and restart the target server, where the weblogic is deployed?