PowerShell UpdateConfJDBC.ps1 ,
function UpdateConfJDBC()
{
<#
.SYNOPSIS
Update SDL Microservice JDBC Configuration
.DESCRIPTION
Set JDBC name in the cd_storage-config.xml files for all SDL
Microservices in the SDLWeb path
The default cd_storage_conf.xml jdbc "user" must be changed to "user@azuredbname"
otherwize connection login fails with error
"sql cannot create PoolableConnectionFactory"
see
https://tridion.stackexchange.com/questions/17586/publishing-fail-on-sdl-web-8-5-content-delivery-with-azure-sql
.EXAMPLE
UpdateConfJDBC -filename "C:\SDL\Web\deployer-combined\config\cd_storage_conf.xml" -Verbose
.EXAMPLE
UpdateConfJDBC -filename "C:\SDL\Web\deployer-combined\config\deployer-conf.xml" -Verbose
#>
param(
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
$filename
)
Write-Verbose "Update Conf JDBC Processing $($filename)"
$Conf = New-Object System.Xml.XmlDocument
$Conf.Load($filename)
$state = $Conf.Deployer.State
if ($state)
{
$user = $state.Storage.Property | Where-Object { $_.name -eq 'user' }
$sqlhost = $state.Storage.Property | Where-Object { $_.name -eq 'host' }
if ($sqlhost.value -like "*.database.windows.net")
{
$dbname = $sqlhost.value.split(".")[0]
$user.value = [string]::Format("{0}@{1}", $user.value.split("@")[0],$dbname)
Write-Verbose " Updated Deployer.State.Storage.Property.user.value to $($user.value)"
$Conf.Save($filename)
}
}
$Storage = $Conf.Configuration.Global.Storages.Storage | Where-Object { $_.Class -like 'com.tridion.storage.persistence.JPADAOFactory' }
if ($Storage)
{
$user = $Storage.DataSource.Property | Where-Object { $_.name -eq 'user' }
$sqlhost = $Storage.DataSource.Property | Where-Object { $_.name -eq 'serverName' }
if ($sqlhost.value -like "*.database.windows.net")
{
$dbname = $sqlhost.value.split(".")[0]
$user.value = [string]::Format("{0}@{1}", $user.value.split("@")[0],$dbname)
Write-Verbose " Updated Configuration.Global.Storages.Storage.DataSource.Property.user.value to $($user.value)"
$Conf.Save($filename)
}
}
}
I hope this helps you to move your solutionsolutions to use Azure SQL.