param(
	[string]$dataSource,
	[string]$database,
	[string]$login,
	[string]$pwd
)

try {
	$connection = New-Object -TypeName System.Data.SqlClient.SqlConnection
	$connection.ConnectionString = "Data Source=" + $dataSource + ";UID=" + $login + ";PWD=" + $pwd + ";Connection Timeout=30;Database=" + $database;
	$command = $connection.CreateCommand()
	$command.CommandText = "EXEC sp_databases" # Just a test command to execute over connection, we do not check any results
	$adapter = New-Object -TypeName System.Data.SqlClient.SqlDataAdapter $command
	$dataset = New-Object -TypeName System.Data.DataSet
	$adapter.Fill($dataset) > $null
	Write-Host "OK"
} catch [Exception] {
	Write-Host $_.Exception.Message
	exit 1
}

