Test-DevartDatabaseConnection

Synopsis

Try to open the specified connection.

Description

Checks that the details in a DatabaseConnection object produced by the New-DevartSqlDatabaseConnection cmdlet can be used to connect to the specified database. If Test-DevartDatabaseConnection can’t connect to the database, it raises an error.

Syntax

Test-DevartDatabaseConnection [-Connection] <object> [<CommonParameters>]

Parameters

-Connection <object>

The DevartDatabaseConnectionInfo or connection string that identifies the connection to test.

Required? true

Position? 0

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false

<CommonParameters>

This cmdlet supports the following common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see About CommonParameters.

Outputs

System.Boolean (returns true on success and false otherwise)

Examples

---------- EXAMPLE 1 ----------
$connection = New-DevartSqlDatabaseConnection -Server $serverName -Database $database -UserName $userName -password $password
Test-DevartDatabaseConnection -Connection $connection