views:

865

answers:

2

Hello

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

+1  A: 

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

Anthony K
Thanks Anthony you put me on the right track. The trick it initially connect to the "postgres" database and then to create my database.
IanW
+1  A: 

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

tom d