Jython - JDBC DS 设置
Jython - JDBC DS settings
我想在我的数据源的自定义属性中将名为 "SendStringParametersAsUnicode" 的现有 属性 更新为真。
2- 我想在数据源的连接池中将最大连接数设置为 50
dsid = AdminTask.createDatasource('provider_id, '[-name [Team Server Datasource] -jndiName jdbc/ilogDataSource -dataStoreHelperClassName com.ibm.websphere.rsadapter.DB2DataStoreHelper -componentManagedAuthenticationAlias RES_db2conn -containerManagedPersistence true -xaRecoveryAuthAlias RES_db2conn -configureResourceProperties [[databaseName java.lang.String ' + str(databaseName) + '] [driverType java.lang.Integer ' + str(driverType) + '] [serverName java.lang.String ' + str(serverName) + '] [portNumber java.lang.Integer ' + portNumber + ']]]')
AdminConfig.create('MappingModule', dsid , '[[authDataAlias RES_db2conn [mappingConfigAlias ""]]')
AdminConfig.save()
print "Configuration changes saved."
import time
time.sleep(10) # Delay for 10 seconds.
AdminControl.testConnection(dsid)
有人知道它的 jython 代码吗?
最后更新:
#provider_id=AdminConfig.getid('/Cell:E1DSCell/JDBCProvider:DB2 XA provider/')
#jdbcProvider1 = AdminConfig.getid('/JDBCProvider:myJdbcProvider/')
provider_id = AdminConfig.getid('/JDBCProvider:Microsoft SQL Server JDBC Driver/')
# dataStoreHelperClassName com.ibm.websphere.rsadapter.MicrosoftSQLServerDataStoreHelper
# componentManagedAuthenticationAlias TEMP-HRZEMM01Node01/PlatformDataSource
#
print "Creating DataSource"
dsid = AdminTask.createDatasource(provider_id, '[-name [Team Server Datasource] -jndiName jdbc/ilogDataSource -dataStoreHelperClassName com.ibm.websphere.rsadapter.MicrosoftSQLServerDataStoreHelper -componentManagedAuthenticationAlias TEMP-HRZEMM01Node01/PlatformDataSource -containerManagedPersistence true -xaRecoveryAuthAlias TEMP-HRZEMM01Node01/PlatformDataSource -configureResourceProperties [[databaseName java.lang.String Compass] [portNumber java.lang.Integer 1433] [serverName java.lang.String SQLSVR1]]]')
AdminConfig.create('MappingModule', dsid , '[[authDataAlias TEMP-HRZEMM01Node01/PlatformDataSource] [mappingConfigAlias ""]]')
ds_name = 'Team Server Datasource' #Name copied from your question, update if required
provider_id = AdminConfig.getid('/JDBCProvider:Microsoft SQL Server JDBC Driver/')
#Get the list of datasources
dsList = AdminConfig.list('DataSource', provider_id).splitlines()
for ds in dsList:
if (ds_name == AdminConfig.showAttribute(ds, "name")):
#Modify Connection Pool
AdminConfig.modify(AdminConfig.showAttribute(ds, 'connectionPool'), '[[maxConnections "50"]]')
#Modify SendStringParametersAsUnicode property if it exists
propSet = AdminConfig.list("J2EEResourcePropertySet", ds)
for prop in AdminConfig.list("J2EEResourceProperty", propSet).splitlines():
if (AdminConfig.showAttribute(prop, "name") == 'SendStringParametersAsUnicode'):
AdminConfig.modify(prop, [["value", "true"]])
AdminConfig.save()
print "Configuration changes saved."
import time
time.sleep(10) # Delay for 10 seconds.
#ds = AdminConfig.getid('/DataSource:SQA MOTOR/')
#print ds #variable displaying
AdminControl.testConnection(dsid)
使用 wsadmin - jython 接口尝试运行以下代码片段:
ds_name = 'Team Server Datasource' #Name copied from your question, update if required
provider_id = #Use the same provider id used for creating the datasource (provider_id used in dsid = AdminTask.createDatasource('provider_id, '[-name [Team Server Datasource] ...)
#Get the list of datasources
dsList = AdminConfig.list('DataSource', provider_id).splitlines()
for ds in dsList:
if (ds_name == AdminConfig.showAttribute(ds, "name")):
#Modify Connection Pool
AdminConfig.modify(AdminConfig.showAttribute(ds, 'connectionPool'), '[[maxConnections "50"]]')
#Modify SendStringParametersAsUnicode property if it exists
propSet = AdminConfig.list("J2EEResourcePropertySet", ds)
for prop in AdminConfig.list("J2EEResourceProperty", propSet).splitlines():
if (AdminConfig.showAttribute(prop, "name") == 'SendStringParametersAsUnicode'):
AdminConfig.modify(prop, [["value", "true"]])
AdminConfig.save()
我想在我的数据源的自定义属性中将名为 "SendStringParametersAsUnicode" 的现有 属性 更新为真。
2- 我想在数据源的连接池中将最大连接数设置为 50
dsid = AdminTask.createDatasource('provider_id, '[-name [Team Server Datasource] -jndiName jdbc/ilogDataSource -dataStoreHelperClassName com.ibm.websphere.rsadapter.DB2DataStoreHelper -componentManagedAuthenticationAlias RES_db2conn -containerManagedPersistence true -xaRecoveryAuthAlias RES_db2conn -configureResourceProperties [[databaseName java.lang.String ' + str(databaseName) + '] [driverType java.lang.Integer ' + str(driverType) + '] [serverName java.lang.String ' + str(serverName) + '] [portNumber java.lang.Integer ' + portNumber + ']]]')
AdminConfig.create('MappingModule', dsid , '[[authDataAlias RES_db2conn [mappingConfigAlias ""]]')
AdminConfig.save()
print "Configuration changes saved."
import time
time.sleep(10) # Delay for 10 seconds.
AdminControl.testConnection(dsid)
有人知道它的 jython 代码吗?
最后更新:
#provider_id=AdminConfig.getid('/Cell:E1DSCell/JDBCProvider:DB2 XA provider/')
#jdbcProvider1 = AdminConfig.getid('/JDBCProvider:myJdbcProvider/')
provider_id = AdminConfig.getid('/JDBCProvider:Microsoft SQL Server JDBC Driver/')
# dataStoreHelperClassName com.ibm.websphere.rsadapter.MicrosoftSQLServerDataStoreHelper
# componentManagedAuthenticationAlias TEMP-HRZEMM01Node01/PlatformDataSource
#
print "Creating DataSource"
dsid = AdminTask.createDatasource(provider_id, '[-name [Team Server Datasource] -jndiName jdbc/ilogDataSource -dataStoreHelperClassName com.ibm.websphere.rsadapter.MicrosoftSQLServerDataStoreHelper -componentManagedAuthenticationAlias TEMP-HRZEMM01Node01/PlatformDataSource -containerManagedPersistence true -xaRecoveryAuthAlias TEMP-HRZEMM01Node01/PlatformDataSource -configureResourceProperties [[databaseName java.lang.String Compass] [portNumber java.lang.Integer 1433] [serverName java.lang.String SQLSVR1]]]')
AdminConfig.create('MappingModule', dsid , '[[authDataAlias TEMP-HRZEMM01Node01/PlatformDataSource] [mappingConfigAlias ""]]')
ds_name = 'Team Server Datasource' #Name copied from your question, update if required
provider_id = AdminConfig.getid('/JDBCProvider:Microsoft SQL Server JDBC Driver/')
#Get the list of datasources
dsList = AdminConfig.list('DataSource', provider_id).splitlines()
for ds in dsList:
if (ds_name == AdminConfig.showAttribute(ds, "name")):
#Modify Connection Pool
AdminConfig.modify(AdminConfig.showAttribute(ds, 'connectionPool'), '[[maxConnections "50"]]')
#Modify SendStringParametersAsUnicode property if it exists
propSet = AdminConfig.list("J2EEResourcePropertySet", ds)
for prop in AdminConfig.list("J2EEResourceProperty", propSet).splitlines():
if (AdminConfig.showAttribute(prop, "name") == 'SendStringParametersAsUnicode'):
AdminConfig.modify(prop, [["value", "true"]])
AdminConfig.save()
print "Configuration changes saved."
import time
time.sleep(10) # Delay for 10 seconds.
#ds = AdminConfig.getid('/DataSource:SQA MOTOR/')
#print ds #variable displaying
AdminControl.testConnection(dsid)
使用 wsadmin - jython 接口尝试运行以下代码片段:
ds_name = 'Team Server Datasource' #Name copied from your question, update if required
provider_id = #Use the same provider id used for creating the datasource (provider_id used in dsid = AdminTask.createDatasource('provider_id, '[-name [Team Server Datasource] ...)
#Get the list of datasources
dsList = AdminConfig.list('DataSource', provider_id).splitlines()
for ds in dsList:
if (ds_name == AdminConfig.showAttribute(ds, "name")):
#Modify Connection Pool
AdminConfig.modify(AdminConfig.showAttribute(ds, 'connectionPool'), '[[maxConnections "50"]]')
#Modify SendStringParametersAsUnicode property if it exists
propSet = AdminConfig.list("J2EEResourcePropertySet", ds)
for prop in AdminConfig.list("J2EEResourceProperty", propSet).splitlines():
if (AdminConfig.showAttribute(prop, "name") == 'SendStringParametersAsUnicode'):
AdminConfig.modify(prop, [["value", "true"]])
AdminConfig.save()