Pages

Wednesday, 4 October 2017

ODBC Setup on Ubuntu for PostgreSQL

ODBC Setup on Ubuntu for PostgreSQL

#Install the basic config tools for the UNIX ODBC:
sudo apt-get install unixodbc-bin unixodbc

#ODBC drivers for PostgreSQL:
sudo apt-get install odbc-postgresql

#Apply the template file provided to setup driver entries:
sudo odbcinst -i -d -f /usr/share/psqlodbc/odbcinst.ini.template

#Setup the a sample DSN
sudo odbcinst -i -s -l  -n adyoung-pg -f /usr/share/doc/odbc-postgresql/examples/odbc.ini.template

#Now modify /etc/odbc.ini according to your DB:
[test]                                                                                                                                                       Description = PostgreSQL                                                                                                                         Driver      = PostgreSQL ANSI                                                                                                                 Trace       = No                                                                                                                                           TraceFile   = /tmp/psqlodbc.log                                                                                                                 Database    = Databasename                                                                                                                       Servername  = localhost                                                                                                                             UserName    = ubuntu                                                                                                                               Password    = ubuntu                                                                                                                                 Port        = 5432                                                                                                                                         ReadOnly         = Yes                                                                                                                                 RowVersioning    = No                                                                                                                               ShowSystemTables = No                                                                                                                           ShowOidColumn    = No                                                                                                                           FakeOidIndex     = No                                                                                                                               ConnSettings     =      


#Now modify /etc/odbcinst.ini:
[PostgreSQL ANSI]
Description=PostgreSQL ODBC driver (ANSI version)
Driver=/usr/lib/x86_64-linux-gnu/odbc/psqlodbca.so
Setup=/usr/lib/x86_64-linux-gnu/odbc/libodbcpsqlS.so
Debug=0
CommLog=1
UsageCount=1

[PostgreSQL Unicode]
Description=PostgreSQL ODBC driver (Unicode version)
Driver=/usr/lib/x86_64-linux-gnu/odbc/psqlodbcw.so
Setup=/usr/lib/x86_64-linux-gnu/odbc/libodbcpsqlS.so
Debug=0
CommLog=1
UsageCount=1

#Check Connection
isql -v test


Reference:
http://digitalitility.com/tutori-alitility/postgresql/odbc-setup-on-ubuntu-for-postgresql/
https://support.zegami.com/tutorials/odbc/index.html

No comments:

Post a Comment