How to find the ODBC driver name for a connection

2019-08-08 23:40发布

问题:

Whenever I use ODBC drivers with a full connection string, and not just a DSN entry, I often get an error similar to this

Data source name not found and no default driver specified

I have the correct syntax of the connection string (or so the Internet says), but I suspect I don't know the correct name for the current version of the ODBC driver I am using

How do I find the correct name, for either 32 or 64 bit?

回答1:

Use the ODBC Data Source Administrator app. Make sure you use the 32 bit or the 64 bit version depending on your applications build target. Then select the "File DSN" tab

Click the "Add" button, and select the driver you have installed

Then click the "Advanced" button

You can then copy and paste the correct driver name, and cancel out of the ODBC Data Source Administrator app

e.g.

DRIVER={PostgreSQL ODBC Driver(UNICODE)}

Add the rest of the parameters required, and you will have a working ODBC connection string for the currently installed version of the driver

e.g.

Driver={PostgreSQL ODBC Driver(UNICODE)};Server=ruru.nz;Port=5432;Database=TheInternet;Uid=tfd;Pwd=p455w0rd;

Enjoy :-)