How can I install ODBC.DSN file so that it can access any database in Postgresql?

I am writing an MFC application to automatically configure Postgresql with ODBC for use by another application. The idea is that the user starts the application and it automatically creates the database and tables inside it. My problem is that when setting 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 have not created mydb yet, so I cannot connect to Postgresql! I tried editing the DSN file so that this line reads ..

DATABASE=

      

and remove it completely, but then I get an error and cannot connect.

Is it possible for the DSN file to allow access to any database? If so, how do you do it?

thank

Yang

0


source to share


2 answers


I'm not familiar with PostgreSql, but is there a database like "master" in SQL Server that you could connect to first and then use another database? You can also try connectionstrings.com



+1


source


"postgres" databases always exist for PostgreSQL and can be used for such tasks.



+1


source







All Articles