title: Connect pyodbc to Postgres
body: <p>Trying to connect to Postgres using pyodbc.</p>
  
  <p>I can connect to the DB with isql:</p>
  
  <pre><code>echo "select 1" | isql -v my-connector
  </code></pre>
  
  <p>Returns:</p>
  
  <pre><code>+---------------------------------------+
  | Connected!                            |
  |                                       |
  | sql-statement                         |
  | help [tablename]                      |
  | quit                                  |
  |                                       |
  +---------------------------------------+
  SQL&gt; select 1
  +------------+
  | ?column?   |
  +------------+
  | 1          |
  +------------+
  SQLRowCount returns 1
  1 rows fetched
  </code></pre>
  
  <p>But when I try to connect with pyodbc:</p>
  
  <pre><code>import pyodbc
  con = pyodbc.connect("DRIVER={PostgreSQL Unicode}; DATABASE=&lt;dbname&gt;;     UID=&lt;username&gt;; PWD=&lt;password&gt;; SERVER=localhost; PORT=5432;")
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>pyodbc.Error: ('08001', '[08001] [unixODBC]connction string lacks some options (202) (SQLDriverConnect)')
  </code></pre>
  
  <p>obdc.ini file looks like this:</p>
  
  <pre><code>[my-connector]
  Description         = PostgreSQL connection to '&lt;dbname&gt;' database
  Driver              = PostgreSQL Unicode
  Database            = &lt;dbname&gt;
  Servername          = localhost
  UserName            = &lt;username&gt;
  Password            = &lt;password&gt;
  Port                = 5432
  Protocol            = 9.3
  ReadOnly            = No
  RowVersioning       = No
  ShowSystemTables    = No
  ShowOidColumn       = No
  FakeOidIndex        = No
  ConnSettings        =
  </code></pre>
  
  <p>odbcinst.ini file looks like this:</p>
  
  <pre><code>[PostgreSQL ANSI]
  Description     = PostgreSQL ODBC driver (ANSI version)
  Driver          = psqlodbca.so
  Setup           = libodbcpsqlS.so
  Debug           = 0
  CommLog         = 1
  UsageCount      = 1
  
  [PostgreSQL Unicode]
  Description     = PostgreSQL ODBC driver (Unicode version)
  Driver          = psqlodbcw.so
  Setup           = libodbcpsqlS.so
  Debug           = 0
  CommLog         = 1
  UsageCount      = 1
  </code></pre>
  
  <p>Notes:</p>
  
  <ul>
  <li>Ubuntu 14.04</li>
  <li>Python 3</li>
  <li>Postgresql 9.3</li>
  </ul>
  
  <p>I have used psycopg2 in the past to connect to Postgres, however my current company uses Netezza, Postgres, and MySQL. I want to write 1 connection module, and use different drivers to connect to the different databases.
  Any help would be greatly appreciated.</p>
  
  <p>-- Thanks</p>