Friday, February 3, 2012

Creating JDBC Multi Data Source through WLST in weblogic server

Creating JDBC Multi Data Source through WLST in weblogic server

The below WLST script will help us to create the Multi Data Source in weblogic server.

CreateMultiDataSource.py

adminURL='t3://<<Admin Server Host>>:<<Port>>'
adminUserName='weblogic'
adminPassword='<<Password>>'
connect(adminUserName, adminPassword, adminURL)
edit()
startEdit()
jdbcSystemResource = create("MS1","JDBCSystemResource")
jdbcResource = jdbcSystemResource.getJDBCResource()
jdbcResource.setName("MS1")
dsParams = jdbcResource.getJDBCDataSourceParams()
jndiName='jdbc/MS1'
dsParams.setJNDINames([jndiName])
dsParams.setAlgorithmType('Failover')
dsParams.setDataSourceList('DS1,DS2')
dsParams.setFailoverRequestIfBusy(true)
jdbcSystemResource.addTarget(getMBean('Servers/AdminServer'))
print('MDS1 created successfully...')
save()
activate()
disconnect()

Before executing this script the member data sources(DS1,DS2) should be created.


1 comment:

  1. I have read your blog its very attractive and impressive. I like it your blog.

    Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

    Java Online Training Java Online Training Core Java 8 Training in Chennai Core java 8 online training JavaEE Training in Chennai Java EE Training in Chennai

    ReplyDelete