Last active
December 28, 2018 12:07
-
-
Save brunoborges/9791626 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WebLogic Connection | |
adminUserName='weblogic' | |
adminPassword='welcome1' | |
adminURL='t3://localhost:7001' | |
# DataSource Details | |
dsName='TestDS' | |
dsJNDIName='jdbc/test' | |
dsDriverName='com.mysql.jdbc.Driver' | |
dsURL='jdbc:mysql://localhost:3306/mysql' | |
dsUserName='root' | |
dsPassword='mysql' | |
# DataSource Details for WebLogic | |
dsTestQuery='SQL SELECT 1\r\n' # example specific for MySQL | |
datasourceTarget='AdminServer' # can be a cluster or another managed server | |
connect(adminUserName, adminPassword, adminURL) | |
edit() | |
startEdit() | |
cd('/') | |
cmo.createJDBCSystemResource(dsName) | |
cd('/JDBCSystemResources/' + dsName) | |
set('Targets',jarray.array([ObjectName('com.bea:Name=' + datasourceTarget + ',Type=Server')], ObjectName)) | |
cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName) | |
cmo.setName(dsName) | |
cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDataSourceParams/' + dsName) | |
set('JNDINames',jarray.array([String(dsJNDIName)], String)) | |
cmo.setGlobalTransactionsProtocol('OnePhaseCommit') | |
cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName) | |
cmo.setUrl(dsURL) | |
cmo.setDriverName(dsDriverName) | |
cmo.setPassword(dsPassword) | |
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 + '/JDBCConnectionPoolParams/' + dsName) | |
cmo.setTestTableName(dsTestQuery) | |
save() | |
activate() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment