●WLSTで設定したデータソース
source $ORACLE_HOME/wlserver/server/bin/setWLSEnv.sh
java weblogic.WLST
connect('weblogic','weblogic01','t3://localhost:8180')
edit()
startEdit()
wls:/FP/edit/ !> cmo.lookupServer('MANAGED_SRV')
[MBeanServerInvocationHandler]com.bea:Name=MANAGED_SRV,Type=Server
wls:/FP/edit/ !> wlsvr=cmo.lookupServer('MANAGED_SRV')
cd('JDBCSystemResources')
cmo.createJDBCSystemResource('DS_USERA_001')
cd('DS_USERA_001')
wls:/FP/edit/ !> cd('/JDBCSystemResources/DS_USERA_001')
wls:/FP/edit/JDBCSystemResources/DS_USERA_001 !> cmo.addTarget(wlsvr)
wls:/FP/edit/JDBCSystemResources/DS_USERA_001 !> cd('/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001')
wls:/FP/edit/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001 !> set('DatasourceType','GENERIC')
wls:/FP/edit/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001 !> cmo.setName('DS_USERA_001')
wls:/FP/edit/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001 !> cd('/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001/JDBCConnectionPoolParams/DS_USERA_001')
wls:/FP/edit/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001/JDBCConnectionPoolParams/DS_USERA_001 !> set('TestTableName','SQL SELECT 1 FROM DUAL')
wls:/FP/edit/JDBCSystemResources/DS_SCOTT_001/JDBCResource/DS_SCOTT_001/JDBCConnectionPoolParams/DS_SCOTT_001 !> set('InitialCapacity',10)
wls:/FP/edit/JDBCSystemResources/DS_SCOTT_001/JDBCResource/DS_SCOTT_001/JDBCConnectionPoolParams/DS_SCOTT_001 !> set('MaxCapacity',10)
wls:/FP/edit/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001/JDBCConnectionPoolParams/DS_USERA_001 !> cd('//JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001/JDBCDriverParams/DS_USERA_001')
wls:/FP/edit/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001/JDBCDriverParams/DS_USERA_001 !> set('DriverName','oracle.jdbc.OracleDriver')
wls:/FP/edit/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001/JDBCDriverParams/DS_USERA_001 !> set('Password','tiger')
wls:/FP/edit/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001/JDBCDriverParams/DS_USERA_001 !> set('Url','jdbc:oracle:thin:@//192.168.100.5:1521/happdb')
wls:/FP/edit/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001/JDBCDriverParams/DS_USERA_001 !> cd('Properties/DS_USERA_001')
wls:/FP/edit/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001/JDBCDriverParams/DS_USERA_001/Properties/DS_USERA_001 !> cmo.createProperty('user')
wls:/FP/edit/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001/JDBCDriverParams/DS_USERA_001/Properties/DS_USERA_001 !> cd('Properties/user')
wls:/FP/edit/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001/JDBCDriverParams/DS_USERA_001/Properties/DS_USERA_001/Properties/user !> set('Value','scott')
wls:/FP/edit/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001/JDBCDriverParams/DS_USERA_001/Properties/DS_USERA_001/Properties/user !> cd('/')
wls:/FP/edit/ !> cd('/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001/JDBCDataSourceParams/DS_USERA_001')
wls:/FP/edit/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001/JDBCDataSourceParams/DS_USERA_001 !> set('GlobalTransactionsProtocol','OnePhaseCommit')
wls:/FP/edit/JDBCSystemResources/DS_USERA_001/JDBCResource/DS_USERA_001/JDBCDataSourceParams/DS_USERA_001 !> cmo.addJNDIName('DS_USERA_001')
save()
activate()
disconnect()
exit()
●接続テスト(要調査)
java weblogic.WLST
connect('weblogic','weblogic01','t3://localhost:8180')
serverRuntime()
testPool()
※これで↓と同等のデータソースができた。
●GUIで設定したデータソース
[weblogic@rhel71ap jdbc]$ cat DS_SCOTT_001-8481-jdbc.xml
<?xml version='1.0' encoding='UTF-8'?>
<jdbc-data-source xmlns="http://xmlns.oracle.com/weblogic/jdbc-data-source" xmlns:sec="http://xmlns.oracle.com/weblogic/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wls="http://xmlns.oracle.com/weblogic/security/wls" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/jdbc-data-source http://xmlns.oracle.com/weblogic/jdbc-data-source/1.5/jdbc-data-source.xsd">
<name>DS_SCOTT_001</name>
<datasource-type>GENERIC</datasource-type>
<jdbc-driver-params>
<url>jdbc:oracle:thin:@//192.168.100.5:1521/happdb</url>
<driver-name>oracle.jdbc.OracleDriver</driver-name>
<properties>
<property>
<name>user</name>
<value>scott</value>
</property>
</properties>
<password-encrypted>{AES256}Hu+ZfiXWViwVrSPU89vCMUuZ5FazAsx0hN7AplGM0KE=</password-encrypted>
</jdbc-driver-params>
<jdbc-connection-pool-params>
<test-table-name>select 1 from dual</test-table-name>
</jdbc-connection-pool-params>
<jdbc-data-source-params>
<jndi-name>DS_SCOTT_001</jndi-name>
<global-transactions-protocol>OnePhaseCommit</global-transactions-protocol>
</jdbc-data-source-params>
</jdbc-data-source>