buggins / ddbc

DDBC is DB Connector for D language (similar to JDBC)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

driver not found for name "postgresql" ("versions": ["VibeDefaultMain"])

Yaisis opened this issue · comments

With DUB "versions": ["VibeDefaultMain"] and the following code:
shared static this()
{
import ddbc;
string url = "postgresql://localhost:5432/db?user=postgres,password=postgres,ssl=true";
auto conn = createConnection(url);
scope(exit) conn.close();
auto stmt = conn.createStatement();
scope(exit) stmt.close();
}
Appears this error:
ddbc.core.SQLException@../../../../../../../../.dub/packages/ddbc-master/ddbc/source/ddbc/common.d(71): DriverFactory: driver is not found for name "postgresql"
Program exited with code -4

seems like you don't have ddbc in PGSQL config. Try doing something like this in your dub.json:

"configurations": [
    {
        "name": "full",
        "versions": ["USE_PGSQL"],
        "libs-posix": ["pq"],
        "libs-windows": ["libpq"],
        "subConfigurations": {
            "ddbc": "PGSQL"
        }
    }
]

seems the format may be ddbc:pgsql:localhost, not ddbc:postgresql://localhost. Seeing as some users will expect it to be similar to JDBC (jdbc:postgresql://localhost), I think the code should allow either pgsql or postgresql. However, it should be more strict about following on with ://

edit: Actually postgresql is correct but some of the tests pass in ddbc:pgsql:localhost. This is mis leading. For the next release I'll make sure the URL format is consistent.