mtxr / vscode-sqltools

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

Connected database not showing #668

Closed gottogethelp closed 1 year ago

gottogethelp commented 3 years ago

Describe the bug:

Connected database not showing

Steps to reproduce the behavior:

Click Add new connection Click MySQL Click TEST CONNECTION - says Successfully connected Click SAVE CONNECTION - says:

capra was added to your settings!
Review JSON Syntax
{
  "database": "belgarath",
  "driver": "MySQL",
  "mysqlOptions": {
    "authProtocol": "default"
  },
  "name": "capra",
  "password": "root",
  "port": 3306,
  "previewLimit": 50,
  "server": "localhost",
  "username": "root"
}

Click CONNECT NOW - displays a new tab:

image

Expected behaviour: Should see my connection in CONNECTIONS but it's not there:

image

Hitting refresh gets me:

image

in the bottom right hand corner.

Desktop (please complete the following information):

SQLTools Version 0.22.11 VSCode Version: 1.47.2 OS: [e.g. Windows, Linux, Mac] Driver: MySQL

Database version: 8.0

Additional context Add any other context about the problem here.

I had successfully installed the SQLTools and SQLTools MySQL/MariaDB extensions and they were working fine. However, I had some issues elsewhere so I'd temporarily uninstalled them whilst trying to bug fix.

I've now added them back and reconnected my MySQL database - everything in the connection process, including testing the connection, looked fine. However, it says No connections found. I've tried a few times with different databases and always the same result - connection process looks fine but no end result.

Weirdly, whenever I click on the refresh button icon then a message pops up in the bottom right of the screen to say Element with id capra|MySQL|localhost|belgarath is already registered. It always says this and never refers to any other database. This is the first database I tried to connect to originally. It also appeared when on the very first reinstall so somewhere it had remembered those settings.

mtxr commented 3 years ago

which VSCode version are you using? is it a remote development setup? are you connecting to docker database?

Can you provide more info? If possible, follow the template here: https://github.com/mtxr/vscode-sqltools/blob/master/.github/ISSUE_TEMPLATE/bug_report.md so I can try to reproduce it here.

gottogethelp commented 3 years ago

Hi. Updated comment

aetherealtea commented 3 years ago

Encountered the exact same behavior.

SQLTools Version 0.23.0 VSCode Version: 1.48.2 OS: Ubuntu 18.04 Driver: MSSQL

I have previously created a similar db connection and deleted SQLTools, after the new installation I'm getting this error too.

savvo commented 2 years ago

I've just run across the same. It seems "Add new connection" doesn't check for duplicate entries, allowing e.g.

    "sqltools.connections": [
        {
            "mysqlOptions": {
                "authProtocol": "default"
            },
            "previewLimit": 50,
            "server": "localhost",
            "port": 3306,
            "askForPassword": true,
            "driver": "MySQL",
            "name": "heretic",
            "database": "default",
            "username": "root"
        },
        {
            "mysqlOptions": {
                "authProtocol": "default"
            },
            "previewLimit": 50,
            "server": "localhost",
            "port": 3306,
            "askForPassword": true,
            "driver": "MySQL",
            "name": "heretic",
            "database": "default",
            "username": "root"
        }
    ]

and resulting in:

Element with id heretic|MySQL|localhost|default is already registered

Worked around it by editing settings.json

TomPohys commented 2 years ago

I was able to delete duplicated connection by Command Palette (Ctrl + Shift + P) -> SQLTools Management: Delete connection. Then the rest of the connection shows up

gjsjohnmurray commented 1 year ago

Starting with today's 0.27.1 release it should no longer be possible to define connections with duplicate IDs using the UI.