mtxr / vscode-sqltools

Database management for VSCode
https://vscode-sqltools.mteixeira.dev?utm_source=github&utm_medium=homepage-link
MIT License
1.52k stars 306 forks source link

Connect to azure mysql - ssl - get error UNKNOWN_CODE_PLEASE_REPORT: SSL connection is required. Please specify SSL options and retry. #491

Open diepes opened 4 years ago

diepes commented 4 years ago

Describe the bug A clear and concise description of what the bug is. Install SQLTools, enter azure details. Click TEST CONNECTION

To Reproduce Steps to reproduce the behavior:

  1. Go to '...' SQLTOOLS
  2. Click on '....' MYSQL
  3. Fill credentials '....'
  4. Click TEST CONNECTION
  5. Receive warning in RED "UNKNOWN_CODE_PLEASE_REPORT: SSL connection is required. Please specify SSL options and retry."

Expected behavior A clear and concise description of what you expected to happen. There to be a [ ] use ssl option

Screenshots If applicable, add screenshots to help explain your problem. image

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

mtxr commented 4 years ago

can you share your settings from json file?

https://vscode-sqltools.mteixeira.dev/driver/mssql#11-specific-options should help.

You probably need to add encrypt: true to your options.

mtxr commented 4 years ago

Still have problems?

EtienneBourque commented 4 years ago

I have the same problem.

With Azure MySQL and MariaDB databases, by default, it requires a certificate to connect. https://docs.microsoft.com/en-us/azure/mysql/howto-configure-ssl

Is this something currently supported by this extension?

Edit:

I got it working from the docs.

Here is a connection profile that works with Azure databases:

{
      "database": "foobar",
      "dialect": "MySQL",
      "name": "FooBar",
      "password": "foobar123",
      "port": 3306,
      "server": "foobar-srv.mysql.database.azure.com",
      "username": "user@foobar-srv",
      "mysqlOptions": {
        "ssl": true
      }
}

We just have to add the ssl true part. Very simple, I thought I might have to point to the BaltimoreCyberTrustRoot certificat they refer to in the Azure docs.

ongkokl commented 3 years ago

Hi there @mtxr

i'm able to connect to the DB , but when run query got same error as show in the screenshot. image

VS Code 1.55.2 Description: SQLTools MySQL/MariaDB Version: 0.2.0 Name: SQLTools Version: 0.23.0 OS : Windows 10 ver 20h2

{
    "sqltools.connections": [

    {
        "mysqlOptions": {
          "authProtocol": "default",
          "ssl" : true,
          "encrypt": true
        },
        "previewLimit": 50,
        "server": "test-nonlive.mysql.database.azure.com",
        "port": 3306,
        "driver": "MySQL",
        "name": "test-nonlive",
        "database": "test_depo",
        "username": "test_readuser",
        "password": "test123123",
        "connectionTimeout": 10000
      }

    ]
}