vscode-sqltools icon indicating copy to clipboard operation
vscode-sqltools copied to clipboard

MS SQL driver: I can get connection to a DB and run SQL but I cannot see list of tables

Open stephanemoulec opened this issue 3 years ago • 46 comments

I can connect to a SQL DB (Azure SQL instance), run code, but when I try to expand the connection to see the list of tables, I get the error "Request connection/GetChildrenForTreeItemRequest failed unexpectedly without providing any details."

I saw issues 640 and 642 but they apply to PostgreSQL. Could not use the solution.

My connection string: ` "sqltools.connections": [

    {
        "mssqlOptions": {
            "appName": "SQLTools",
            "useUTC": true,
            "encrypt": true
        },
        "previewLimit": 50,
        "server": "<my db server>",
        "port": 1433,
        "driver": "MSSQL",
        "name": "<my db name>",
        "database": "<my db name>",
        "username": "<user>",
        "password": "<password>"
    }
],`

stephanemoulec avatar Oct 11 '20 19:10 stephanemoulec

Problem still exists. In most recent version (both VS Code and extension), I get message "Running the contributed command: 'sqltools.getChildrenForTreeItem' failed." when opening the tree

stephanemoulec avatar Feb 07 '21 17:02 stephanemoulec

I've the same issue - using latest version 1.10.1 with the below properties. When expanding the connection getting the following error "Request connection/GetChildrenForTreeItemRequest failed unexpectedly without providing any details". I'm able to execute the SQLs without any issues after double clicking the connection.

{ "mssqlOptions": { "appName": "SQLTools", "useUTC": true, "encrypt": true }, "previewLimit": 50, "server": "", "port": 1433, "driver": "MSSQL", "name": "", "database": "", "username": "", "password": "" }

anil-github-dev avatar Feb 17 '21 05:02 anil-github-dev

Running into the same issue/error, using PostgreSQL.

Database is visibly connected, running simple sql (create table) works fine. But cannot expand the connected db, error message keeps popping up:

Running the contributed command: 'sqltools.getChildrenForTreeItem' failed.

Code4OSINT avatar Feb 19 '21 22:02 Code4OSINT

I had the same issue today with a MariaDB database. Turned out the password was wrong, once I used the correct password the table tree was showing up in the sidebar. Really weird. I logged in as root user to the development database in case that matters.

The extension doesn't seem to handle invalid connections or wrong passwords correctly. When using some random IP address were no database is running I get all kinds of weird errors, instead of a useful one.

EDIT: The database showed up as successfully connected even though I used the wrong password.

magiruuvelvet avatar Mar 03 '21 13:03 magiruuvelvet

guys mine also have same problem

Running the contributed command: 'sqltools.getChildrenForTreeItem' failed.

SADANANDKUMAR avatar Mar 05 '21 13:03 SADANANDKUMAR

guys mine also have same problem

Running the contributed command: 'sqltools.getChildrenForTreeItem' failed.

Same problem!

DustinWin avatar Mar 05 '21 16:03 DustinWin

You need to click the plug icon (which is beside the name of the connection) to connect to the database, then it will ask for password.

MarcosBaungartner avatar Mar 12 '21 03:03 MarcosBaungartner

Same issue here:

Environment VSCode: February 2021 (version 1.54) SQL Tools: V 0.2.0 OS: OS11.2.3 ( Apple silicon)

Error: Running the contributed command: 'sqltools.getChildrenForTreeItem' failed. image

Here is the connection, it is fine, as it has the green dot for connected as well as the option to disconnect. image

Here is my select to return data (So it is connecting fine) image

rangitoto72 avatar Mar 15 '21 19:03 rangitoto72

Same issue

Extension version: 0.23.0 VS Code version: Code 1.54.3 OS version: Linux x64 5.8.0-45-generic

paintmeyellow avatar Mar 20 '21 12:03 paintmeyellow

I also had the same issue as I switched to root user it worked fine. But logging in as another user doesn't work.

sajadshafi avatar Mar 22 '21 16:03 sajadshafi

same problem, OS Windows 10

filasik avatar Mar 30 '21 12:03 filasik

I have the same problem. OS: Windows 10

Kaloyanes avatar Apr 11 '21 11:04 Kaloyanes

Tested my connection credentials in dbeaver and this, and I'm getting the sqltools.getChildrenForTreeItem error for all but one connection. Was able to expand tables for one of them but the other 3 connections I'm trying aren't working.

chris-larsen avatar Apr 11 '21 17:04 chris-larsen

same issue! i'm using MySQL server 8.0.23 on vscode 1.55.2 linux ubuntu 20.04 LTS it gives me an error with the message: "running the contributed command: 'sqltools.getChildrenForTreeItem' failed"

Pedram-Mirelmi avatar Apr 14 '21 17:04 Pedram-Mirelmi

https://stackoverflow.com/questions/50093144/mysql-8-0-client-does-not-support-authentication-protocol-requested-by-server/50131831#50131831

Execute the following query in MYSQL Workbench

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'

Where root as your user localhost as your URL and password as your password

Then run this query to refresh privileges:

flush privileges;

Try connecting using node after you do so.

If that doesn't work, try it without @'localhost' part.

LucasMarmo avatar Apr 17 '21 00:04 LucasMarmo

https://stackoverflow.com/questions/50093144/mysql-8-0-client-does-not-support-authentication-protocol-requested-by-server/50131831#50131831

Execute the following query in MYSQL Workbench

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'

Where root as your user localhost as your URL and password as your password

Then run this query to refresh privileges:

flush privileges;

Try connecting using node after you do so.

If that doesn't work, try it without @'localhost' part.

Might work but as you can see, the initial query, as with my issue is for TSQL ( Microsoft SQL Server. NOT MySql ), so using root@localhost has nothing to do with it.

rangitoto72 avatar Apr 23 '21 09:04 rangitoto72

Same Issue here.

psinnathurai avatar May 07 '21 17:05 psinnathurai

Same here

ecesar88 avatar May 16 '21 22:05 ecesar88

I was having the same problem. I decided to change the user to 'root' and in the password I left with ask when connecting, from that moment there was no error

NathanSFon avatar May 22 '21 21:05 NathanSFon

Same issue for me too :(

mdavinicius avatar Jun 02 '21 18:06 mdavinicius

Me too I'm running MySQL on docker with WSL2 (Ubuntu) Latest version of VSCode and SQLTools

My docker-compose

version: '3'

services: 
    db:
        container_name: mysql
        image: mysql
        restart: always
        environment: 
            MYSQL_ROOT_PASSWORD: test123*

    
    phpmyadmin:
        image: phpmyadmin
        restart: always
        ports:
            - 8080:80
        environment:
            PMA_HOST: db
            PMA_USER: root
            PMA_PASSWORD: test123*

networks:
    default:
        external: true
        name: web

SQLTools connection

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

KianoJ avatar Jun 10 '21 08:06 KianoJ

Same thing here... would be Nice to have a decent fix or someone to point me into the right way... Using docker on wsl2

shinzoke avatar Jun 14 '21 01:06 shinzoke

https://stackoverflow.com/questions/50093144/mysql-8-0-client-does-not-support-authentication-protocol-requested-by-server/50131831#50131831

Execute the following query in MYSQL Workbench

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'

Where root as your user localhost as your URL and password as your password

Then run this query to refresh privileges:

flush privileges;

Try connecting using node after you do so.

If that doesn't work, try it without @'localhost' part.

If anyone is having trouble with mysql 8.0 and above, use this and it will work.

RoneyThomas avatar Jun 29 '21 12:06 RoneyThomas

Hey, I'm not sure how MySQL got into this but the original issue was raised for MS SQL. Is this fix supposed to work for MS SQL too?

iwogar avatar Aug 17 '21 12:08 iwogar

Hey, I'm not sure how MySQL got into this but the original issue was raised for MS SQL. Is this fix supposed to work for MS SQL too?

Yup

RoneyThomas avatar Aug 18 '21 03:08 RoneyThomas

Hi, any explanation for this error beside having to downgrade!!!?

psmatsinhe avatar Sep 08 '21 23:09 psmatsinhe

Hey, I'm not sure how MySQL got into this but the original issue was raised for MS SQL. Is this fix supposed to work for MS SQL too?

refer to Aidin's answer below that stackoverflow post.

huangjj27 avatar Sep 20 '21 08:09 huangjj27

Hi, any explanation for this error beside having to downgrade!!!?

refer to Aidin's answer below that stackoverflow post.

huangjj27 avatar Sep 20 '21 08:09 huangjj27

I think this issue can be fixed by adding support of authorization for caching_sha2_password, but as is mentioned in #101, this issue of MySQL version may be not fixed.

huangjj27 avatar Sep 20 '21 08:09 huangjj27

in my case the problem was solved by changing the hostname "localhost" by the local ip "127.0.0.1"

willycotes avatar Oct 18 '21 20:10 willycotes