wlst create datasource in weblogic

wlst script create datasource


connect("weblogic","weblogic1", "t3://localhost:7001")
edit()

# Change these names as necessary
dsname="CPFDS"
server="AdminServer"
cd("Servers/"+server)
target=cmo
cd("../..")

startEdit()
# start creation
print 'Creating JDBCSystemResource with name '+dsname
jdbcSR = create(dsname,"JDBCSystemResource")
theJDBCResource = jdbcSR.getJDBCResource()
theJDBCResource.setName( dsname )

connectionPoolParams = theJDBCResource.getJDBCConnectionPoolParams()
connectionPoolParams.setConnectionReserveTimeoutSeconds(25)
connectionPoolParams.setMaxCapacity(100)
connectionPoolParams.setTestTableName("dual")

dsParams = theJDBCResource.getJDBCDataSourceParams()
dsParams.addJNDIName("jdbc/CPFDS")

driverParams = theJDBCResource.getJDBCDriverParams()
driverParams.setUrl("jdbc:oracle:thin:@192.168.98.132:1521:wcs")
driverParams.setDriverName("oracle.jdbc.driver.OracleDriver")
driverParams.setPassword("welcome1")

driverProperties = driverParams.getProperties()

proper = driverProperties.createProperty("user")
proper.setValue("CPF")

jdbcSR.addTarget(target)

save()
activate(block="true")

print 'Done configuring the data source'

猜你喜欢

转载自e-soft.iteye.com/blog/1377735
今日推荐