New-DevartSqlDatabaseConnection

Synopsis

Builds a connection object to a database.

Description

The cmdlet returns the DevartDatabaseConnectionInfo object.

Syntax

New-DevartSqlDatabaseConnection [-Server] <string> [-Database] <string> [[-UserName] <string>] [[-Password] <string>] 
[[-WindowsAuthentication] <SwitchParameter>] [[-ConnectionTimeout] <int>] [<CommonParameters>]

Parameters

-Server

Specifies the name or network address of the SQL Server instance where the destination database resides.

-Server <string>
Property Default value
Required True
Position 1
Default value -
Accept pipeline input False
Accept wildcard characters False

-Database

Specifies the database you want to connect to.

-Database <string>
Property Default value
Required True
Position 2
Default value -
Accept pipeline input False
Accept wildcard characters False

-UserName

Specifies the username you use for the SQL Server account to connect to the database.

-UserName <string>
Property Default value
Required False
Position 3
Default value -
Accept pipeline input False
Accept wildcard characters False

-Password

Specifies the password you use for the SQL Server account to connect to the database.

-Password <string>
Property Default value
Required False
Position 4
Default value -
Accept pipeline input False
Accept wildcard characters False

-WindowsAuthentication

Allows a user to connect to the server using a Windows user account.

-WindowsAuthentication <SwitchParameter>
Property Default value
Required False
Position 5
Default value False
Accept pipeline input False
Accept wildcard characters False

-ConnectionTimeout

Sets the timeout period (in seconds) for establishing a connection to the server.

-ConnectionTimeout <int>
Property Default value
Required False
Position 6
Default value 15
Accept pipeline input False
Accept wildcard characters False

Common parameters

<CommonParameters>

This cmdlet supports these common parameters:

  • Verbose – Provides detailed output about the command operation.
  • Debug – Provides debugging information.
  • ErrorAction – Specifies how to respond to errors.
  • ErrorVariable – Stores error messages in a variable.
  • WarningAction – Specifies how to respond to warnings.
  • WarningVariable – Stores warning messages in a variable.
  • InformationAction – Specifies how informational messages are handled.
  • InformationVariable – Stores informational messages in a variable.
  • OutBuffer – Controls the number of objects buffered before output.
  • PipelineVariable – Stores the current pipeline object in a variable.
  • OutVariable – Stores output objects in a variable.

For more information, see About Common Parameters.

Output

Devart.DbForge.DevOpsAutomation.SqlServer.DevartDatabaseConnectionInfo

Example

$connection = New-DevartSqlDatabaseConnection -Server $serverName -Database $database -UserName $userName -Password $password

Related links

For a list of default values for the parameters, see the web documentation.