2

I'm trying for the first time to get my project to run in Visual Studio Code. This includes a MySQL database. So I've installed the SQL Server (mssql) extension version 1.7.1. I follow the instructions here: https://learn.microsoft.com/en-us/sql/visual-studio-code/sql-server-develop-use-vscode?view=sql-server-ver15

I get to the section "Connect to SQL Server" and enter:

  • servername: localhost
  • db name: c3
  • Authentication type: Integrated

At the end of the section it should connect with the server but instead I get two errors:

mssql: Error "Unable to connect using the connection information provided. Retry profile creation?"

mssql: Error 2: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

Does anyone see what is going wrong here? I've re-installed the extension but with the same result.

6
  • 1
    A MySQL db and Microsoft SQL Server db are two different things. It seems that there's no SQL Server installed? You might install the free SQL Server Express Version, create the database in there and then connect from Visual Studio Code... Commented Nov 26, 2019 at 18:20
  • Oh, I feel so stupid right now haha, No it's really a MySql db that I would like to have (all knex code is meant for a mysql db). Is there an extension for Mysql as well? Commented Nov 26, 2019 at 18:24
  • Yepp.. here... Commented Nov 26, 2019 at 18:25
  • Sorry for these newbie questions: but am I right that in addition to having these extensions I also somehow need to install a server (so outside of Visual Studio Code)? I'm new to all of this and have always used an IDE that took care of all that. Commented Nov 26, 2019 at 18:27
  • 1
    Yes.. you have to install the database server yourself as VS Code is just a client. You might also use somekind of hosted offers (many webhosters offer a mysql server with self service installation)... Or use some other database (e.g. SqlLite) which can also be used without installation, as it's file based. Commented Nov 26, 2019 at 18:31

3 Answers 3

2

A MySQL db and Microsoft SQL Server db are two different things.

It seems that there's no SQL Server installed? You might install the free SQL Server Express Version, create the database in there and then connect from Visual Studio Code.

You have to install the database server yourself as VS Code is just a client. You might also use somekind of hosted offers (many webhosters offer a mysql server with self service installation, or use a cloud based database server). Yout can also use a local database (e.g. SqlLite) which is file based and doesn't need a special installation.

Sign up to request clarification or add additional context in comments.

Comments

0

You should do the following

  1. install SQL server in your machine and create Database here

  2. Create a login and a database user here

  3. If you are Using VS code install SQL Server (mssql) open new connection, follow the prompts to specify the properties for the new connection profile

  4. If you want to login to your server to make sure of your data

    sqlcmd -S localhost -U SA -P '<YourPassword>'
    

Comments

0

Follow the steps:

In Visual Studio Code:

  1. Install the SQL server extension. After installation, you must see a box on the left panel of your VS Code screen. Select it.
  2. Add Connection
  3. Type Server name (from your MS SQL server) and hit Enter.
  4. Select Integrated
  5. Give your Connection Name and hit Enter.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.