-2

I`m trying to connect to postgresql database which name is "galaxydatabase" and I encountered an unhandled exception. Source code:

#include <Wt/Dbo/Dbo>
#include <Wt/Dbo/backend/Postgres>

namespace dbo = Wt::Dbo;

void run()
{
    dbo::backend::Postgres po;
    po.connect("galaxydatabase");
    // or
    //dbo::backend::Postgres po("galaxydatabase"); // the same exception???
}

int main(int argc, char **argv)
{
    run();
}

enter image description here

user3455638
  • 569
  • 1
  • 6
  • 17

1 Answers1

2

connect() expects a PostgreSQL connection string, e.g. "host=127.0.0.1 user=test password=test port=5432 dbname=test". You can provide different parameters as needed, leave out what is not needed.

The PostgreSQL documentation has more on what parameters are allowed and what they do.

Daniel Frey
  • 55,810
  • 13
  • 122
  • 180