GlassFish Resources コネクションプールの変更を PowerShell で行う
管理コンソールから変更するのは面倒なので PowerShell で行う。
値を変更しても、再起動しないと適用されないので注意。
前提条件
- Windows Server 2012 R1
- GlassFish Server Open Source Edition 4.1.1 (build 1)
- GlassFishのインストール先は C:\Program Files 直下
- adminのパスワードを記載したファイル passwords.txt は C:\Program Files\glassfish4\bin に配置
change_database_connection.ps1
Set-Location "C:\Program Files\glassfish4\bin" # 環境A = pool_A, 環境B = pool_B $poolName = "pool_A" .\asadmin --user admin --passwordfile .\passwords.txt set "domain.resources.jdbc-resource.{JDBC Resources JNDI名}.pool-name=$poolName" Restart-Service -Name domain1 Write-Output "10秒後自動に終了します。" Start-Sleep -s 10