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

Can't create new connection

Open phecht opened this issue 7 years ago • 5 comments

I click on the "Server not selected". I choose new connection. I select PostgreSQL. It isn't on localhost. When I paste in the URI, it already filled it out and is asking for the database.

I created a default for my localhost, but couldn't get that to work either. Is there a way to edit a connection?

Is there a way I can get a form or add a database connection manually?

phecht avatar Apr 09 '18 19:04 phecht

I don't think you can use a URI as the host, it's expecting domain or domain:port, like example.org or example.org:5432. Once you create a connection and connect successfully, you can then run the SQL: Save current server command to save it.

Here is an example of the Workspace Settings file without any settings besides the vscode-database. Options for the type settings are mysql or postgres. This will set up a connection manually.

{
    "database.connections": [
        {
            "type": "postgres",
            "name": "your config name",
            "user": "your-db-user",
            "host": "example.com:5432",
            "password": "your-db-password",
            "database": "your_database"
        }
    ]
}

EDIT: Correction, these settings live in the Workspace Settings, not the User Settings. You may need to reload the window to get them to show up.

palexander avatar Apr 26 '18 01:04 palexander

Thanks for the reply. I was able to create an mysql connection, but it does seem to save between sessions,

phecht avatar Apr 28 '18 17:04 phecht

I have successfully connected to mysql and using the setting above I was able to save the connection. It automatically connects whenever I open VSCode.

Fenweldryn avatar Jun 20 '18 13:06 Fenweldryn

Hello I have the same problem above. After setting up, it displays errors. Please I am totally new to using VS Code and have already installed required PHP extensions and vscode-database on it. What next step should I take to completely set up the connection database to MySQL. NB: I have also Xampp installed on my machine. Your help is really appreciated.

ljsharp avatar Aug 04 '18 13:08 ljsharp

Looks like the real problem is the form that doesn't shows up so you could set the server info. I hard set it two at the JSON file and it got connected after I restart it.

AdaoBMF avatar Mar 10 '22 01:03 AdaoBMF