buggins / ddbc

DDBC is DB Connector for D language (similar to JDBC)
78 stars 45 forks source link

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

Closed Yaisis closed 5 years ago

Yaisis commented 7 years ago

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

SingingBush commented 5 years ago

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"
        }
    }
]
SingingBush commented 5 years ago

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.