Simon Norton
Simon Norton

Reputation: 125

Vim dadbod configuring adapters

I'm trying to configure the plugin dadbod (https://github.com/tpope/vim-dadbod) and must confess I don't know vimscript well enough to comprehend the code :(

I'm stuck on configuring the database adapters. Irrespective of what URL I try, I just get the message

DB: no adapter for SQL Server.

I've also tried SQLite and Postgres with the same results.

In the WIKI, there's a statement: Supports a modern array of backends - which makes me think I haven't configured "the backend" perhaps? I have the jdbc SQL Server driver installed, and set a JAVA_HOME environment variable which works fine with DBeaver and with Azure Data Studio.

I haven't been able to find anything on the web about how to configure dadbod beyond the command structure. Am I missing something obvious about how the plugin works?

Your help greatly appreciated!

Upvotes: 2

Views: 3477

Answers (2)

128
128

Reputation: 1040

I ended up using vim-dadbod-ui plugin and this is how I set it up:

    "tpope/vim-dadbod", -- Modern database interface for Vim
{
    "kristijanhusak/vim-dadbod-ui",
    dependencies = {
        { "tpope/vim-dadbod", lazy = true },
        { "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true },
    },
    cmd = {
        "DBUI",
        "DBUIToggle",
        "DBUIAddConnection",
        "DBUIFindBuffer",
    },
    init = function()
        -- Your DBUI configuration
        vim.g.db_ui_use_nerd_fonts = 1
        vim.g.dbs = {
            dev = "postgres://postgres:mypassword@localhost:5432/my-dev-db",
            staging = "postgres://postgres:mypassword@localhost:5432/my-staging-db",
            wp = "mysql://root@localhost/wp_awesome",
            dockerpostgresboiler = "postgresql://backend:[email protected]:5432/backend",
        }
    end,
},

The DBUI windows do conflict with my auto-session plugin, but that's a problem for another day!

Upvotes: 0

Simon Norton
Simon Norton

Reputation: 125

The vim-dadbod plugin was definitely not installed correctly. I did a clean install of Vim, then installed the package manager Vundle. Following Vundle's instructions I was able to install vim-dadbod.

The issue is no longer the plugin itself!

Upvotes: 2

Related Questions