fusionpbx-install.sh/windows/resources/test-odbc.ps1

18 lines
456 B
PowerShell
Raw Normal View History

2018-01-03 09:13:29 +01:00
Function Test-ODBC([string]$DSN,[string]$username,[string]$password) {
$connection_string = "DSN=$DSN;"
if ($username) {
$connection_string += "username=$username;"
}
if ($password) {
$connection_string += "password=$password;"
}
$conn = New-Object System.Data.Odbc.OdbcConnection
$conn.ConnectionString = $connection_string
$conn.open()
$result = ($conn.State -eq "Open")
if ($result) {
$conn.Close()
}
return $result
}