Test-DevartDatabaseConnection

Last modified: March 28, 2025

Synopsis

Tries to open a 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

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false

<CommonParameters>

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

Inputs

System.Object

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

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