« Panther Woes | Main | Mail.app and ssh tunnels »
November 13, 2003
Panther ODBC
One bit of good did come out of the whole fiasco I've been fumbling through today with the loss of data. I was finally able to get a working ODBC connection to PostgreSQL again.
Steps taken went like so:
1) Download the latest pgODBC system, build and compile it. I compiled these into a temporary directory that I could blow away easily if I screwed things up. But it seems safe enough to just put this directly into your PostgreSQL share directory, as they contain nothing that dangerous. Oddly enough using the drivers found with the PostgreSQL 7.3.2 install on Apple's OS X software page does not seem to work at all.
2) Add the driver via ODBC Administrator. Find the shared library or static library you just built and add it as a driver to the system in the Driver file area. Give it a description of whatever you want. As for the Setup file I pointed that to the psqlodbc.la file (when used with shared libraries) and this seemed to be the magic trick here.
3) Configure your UserDSN. I followed most of the same as my earlier post, but in this case I cut down a lot of the useless data from before. You'll find a copy of it in the Extended Body for reference if you're curious. Remember to correct (by hand) the generated odbc.ini file before moving to the next step.
4) Test connection with odbctest. After a few email conversations with people, I realize I may have misled some in the notation. The proper notation (as I understand it) is to state something like DSN=pgtest where pgtest is the name of the DSN you wish to connect to. If everything goes successfully, you'll find yourself at a SQL prompt awaiting your every command.
Enjoy.
--------- begin odbc.ini ----------
[pgtest]
Driver = /Users/dank/lib/psqlodbc.so
Description = the new PGSQL ODBC driver
Database = dank
Servername = localhost
ReadOnly = 0
Username = dank
Port = 5432
------- end odbc.ini -------
Posted by Dan at November 13, 2003 09:07 PM