


Also review the connection troubleshooting recommendations. To open the Output panel, select View > Output. If the connection fails, try to diagnose the problem from the error message in the Output panel in Visual Studio Code. Type a name for the connection profile, such as localhost profile.Īfter you enter all values and select Enter, Visual Studio Code creates the connection profile and connects to the SQL Server. Select No to be prompted for the password each time the connection profile is used. Press Enter to select Yes and save the password. If you selected SQL Login, enter the name of a user with access to a database on the server.Įnter the password for the specified user. To connect to the default database, don't specify a database name here. If your instance is listening on 1433, you do not need to specify the port.Īs an alternative, you can enter the ADO connection string for your database here. A default instance of SQL Server uses 1433 unless modified. For example, for a server listening on port 1401, enter ,1401.īy default, the connection string uses port 1433. If you need to specify a port, use a comma to separate it from the name. To connect to a SQL Server container, specify the IP address of the container's host machine. To connect to a remote SQL Server, enter the name of the target SQL Server, or its IP address. Use localhost to connect to a SQL Server instance on your local machine. After specifying each value, press Enter to continue. Then select Create to create a new connection profile for your SQL Server.įollow the prompts to specify the properties for the new connection profile. Select the MS SQL: Manage Connection Profiles command.

A SQL file, such as the empty SQL file you created, must have focus in the code editor before you can execute the mssql commands.
