通过wlst创建weblogic域和数据源

# 要求本机装有weblogic能正常运行~!~......
#运行方式为:
# $weblogicDir$/common/bin/wlst.cmd  本文件路径 以.py结尾
#创建域
#然后在此域下创建jndi 并关联
#[]内容为变量
#=======================================================================================
# Create a domain.
#=======================================================================================

createDomain('[weblogicDir]/common/templates/domains/wls.jar','[appDir]', 'weblogic', '[domainAdminPassword]')

#=======================================================================================
# Open a domain.
#=======================================================================================
readDomain('[appDir]')

#=======================================================================================
# Set a domain name.
#=======================================================================================
set('Name','xf_domain')

#=======================================================================================
# Configure the Administration Server and SSL port.
#
# To enable access by both local and remote processes, you should not set the
# listen address for the server instance (that is, it should be left blank or not set).
# In this case, the server instance will determine the address of the machine and
# listen on it.
#=======================================================================================
cd('Servers/AdminServer')
set('ListenAddress','')
set('ListenPort', [weblogicPort])

#===========================================================
# Create and configure a JDBC Data Source, and sets the JDBC user.
#===========================================================
cd('/')

create('db_xf', 'JDBCSystemResource')

cd('JDBCSystemResource/db_xf/JdbcResource/db_xf')

create('db_xf','JDBCDriverParams')

cd('JDBCDriverParams/NO_NAME_0')

set('DriverName','com.microsoft.sqlserver.jdbc.SQLServerDriver')

set('URL','jdbc:sqlserver://[DBHOST]:[DBPORT];DatabaseName=[DBNAME]')

set('PasswordEncrypted', '[DBUSERPWD]')

set('UseXADataSourceInterface', 'false')

create('db_xf','Properties')

cd('Properties/NO_NAME_0')

create('User', 'Property')

cd('Property/User')

cmo.setValue('[DBUSER]')

cd('/JDBCSystemResource/db_xf/JdbcResource/db_xf')

create('db_xf','JDBCDataSourceParams')
cd('JDBCDataSourceParams/NO_NAME_0')
set('JNDIName', java.lang.String("jdbc/db_xf"))
cd('/JDBCSystemResource/db_xf/JdbcResource/db_xf')
create('db_xf','JDBCConnectionPoolParams')

cd('JDBCConnectionPoolParams/NO_NAME_0')
set('TestTableName','SQL SELECT 1')
set('ConnectionReserveTimeoutSeconds', 25)
set('InitialCapacity', 50)
set('MaxCapacity', 300)
set('CapacityIncrement', 50)
set('StatementCacheSize', 30)
set('InactiveConnectionTimeoutSeconds', 30)

#===========================================================
# Target resources to the servers.
#===========================================================
cd('/')
assign('JDBCSystemResource', 'db_xf', 'Target', 'AdminServer')

#=======================================================================================
# update the domain and close the domain.
#=======================================================================================
updateDomain()
closeDomain()

#=======================================================================================
# Exit WLST.
#=======================================================================================
exit()

转载于:https://www.cnblogs.com/aomo/archive/2011/11/24/2261904.html

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值