Creating a Data Source via WLST Offline

Peter Lorenzen
22/02-2013

I have been messing around with silent install of FMW and creating domains via WLST. I was initially trying to get as much as possible done via offline WLST and therefore wanted to create a Data Source. I could not find any examples online which was a bit puzzling since there are lots of online WLST scripts around. I now realize that this is because it is a bit more complicated to do offline :-) When you do it online a lot of things gets created for you while you have to create everything yourself if is offline.

I am not sure if I will keep trying to do everything offline, but here is some WLST that creates a Data Source offline.

print 'create wlsbjmsrpDataSource'
create('wlsbjmsrpDataSource', 'JDBCSystemResource')
cd('/JDBCSystemResource/wlsbjmsrpDataSource')
set('Target','AdminServer,osb_server1')

cd('/JDBCSystemResource/wlsbjmsrpDataSource/JdbcResource/wlsbjmsrpDataSource')
cmo.setName('wlsbjmsrpDataSource')

print 'create JDBCDataSourceParams'
cd('/JDBCSystemResource/wlsbjmsrpDataSource/JdbcResource/wlsbjmsrpDataSource')
create('myJdbcDataSourceParams','JDBCDataSourceParams')
cd('JDBCDataSourceParams/NO_NAME_0')
set('JNDIName', java.lang.String('wlsbjmsrpDataSource'))
set('GlobalTransactionsProtocol', java.lang.String('None'))

print 'create JDBCDriverParams'
cd('/JDBCSystemResource/wlsbjmsrpDataSource/JdbcResource/wlsbjmsrpDataSource')
create('myJdbcDriverParams','JDBCDriverParams')
cd('JDBCDriverParams/NO_NAME_0')
set('DriverName','oracle.jdbc.OracleDriver')
set('URL','jdbc:oracle:thin:@wintermute:1521:mysid')
set('PasswordEncrypted', 'manager')
set('UseXADataSourceInterface', 'false')

print 'create JDBCDriverParams Properties'
create('myProperties','Properties')
cd('Properties/NO_NAME_0')
create('user','Property')
cd('Property')
cd('user')
set('Value', 'scott')

print 'create JDBCConnectionPoolParams'
cd('/JDBCSystemResource/wlsbjmsrpDataSource/JdbcResource/wlsbjmsrpDataSource')
create('myJdbcConnectionPoolParams','JDBCConnectionPoolParams')
cd('JDBCConnectionPoolParams/NO_NAME_0')
set('TestTableName','SQL SELECT 1 FROM DUAL')

Leave a Comment

Previous post:

Next post: