IanW
IanW

Reputation: 1314

How do I set a ODBC .DSN file to allow it to access any database in Postgresql?

I'm writing an MFC App to automatically configure Postgresql with ODBC for use by another app. The idea being that the user runs the app and it automatically creates the database and the tables within it. My problem is that when I set up the File DSN it seems to require the name of the database it will access. This appears in the DSN file as ..

DATABASE=mydb

However I haven't created mydb yet so can't connect to Postgresql ! I have tried editing the DSN file so this line reads ..

DATABASE=

and removing it totally but then I get an error and can't connect.

Is it possible for a DSN file to allow access to any database ? If so how do I do this ?

Thanks

Ian

Upvotes: 0

Views: 2782

Answers (2)

tom d
tom d

Reputation: 111

The database 'postgres' always exists for PostgreSQL and can be used for tasks like these.

Upvotes: 1

Anthony K
Anthony K

Reputation: 2603

I am not familiar with PostgreSql, but is there a database like 'master' in SQL Server that you could initially connect to, and then later use a different database?
You might also want to try connectionstrings.com

Upvotes: 1

Related Questions