title: Pyodbc - "Data source name not found, and no default driver specified"
body: <p>I have trouble getting <code>pyodbc</code> work. I have <code>unixodbc</code> , <code>unixodbc-dev</code>, <code>odbc-postgresql</code>, <code>pyodbc</code> packages installed on my Linux Mint 14.
  I am losing hope to find solution on my own, any help appreciated. See details below:</p>
  
  <p><strong>Running:</strong></p>
  
  <pre><code>&gt;&gt;&gt; import pyodbc
  &gt;&gt;&gt; conn = pyodbc.connect("DRIVER={PostgreSQL};SERVER=localhost;DATABASE=test;USER=openerp;OPTION=3;")
  </code></pre>
  
  <p><strong>Gives me:</strong></p>
  
  <pre><code>&gt;&gt;&gt; pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)')
  </code></pre>
  
  <p><strong># odbcinst -j gives</strong>:</p>
  
  <pre><code>unixODBC 2.2.14
  DRIVERS............: /etc/odbcinst.ini
  SYSTEM DATA SOURCES: /etc/odbc.ini
  FILE DATA SOURCES..: /etc/ODBCDataSources
  USER DATA SOURCES..: /home/atman/.odbc.ini
  SQLULEN Size.......: 4
  SQLLEN Size........: 4
  SQLSETPOSIROW Size.: 2
  </code></pre>
  
  <p>Which makes me think there is a <code>unixodbc</code> configuration problem.
  Here are my <code>unixodbc</code> config file contents:</p>
  
  <p><strong>File</strong> <code>/etc/odbcinst.ini</code><strong>:</strong></p>
  
  <pre><code>[PostgreSQL ANSI]
  Description     = PostgreSQL ODBC driver (ANSI version)
  Driver      = psqlodbca.so
  Setup       = libodbcpsqlS.so
  Debug       = 0
  CommLog     = 1
  UsageCount      = 2
  
  [PostgreSQL Unicode]
  Description     = PostgreSQL ODBC driver (Unicode version)
  Driver      = psqlodbcw.so
  Setup       = libodbcpsqlS.so
  Debug       = 0
  CommLog     = 1
  UsageCount      = 2
  </code></pre>
  
  <p><strong>File</strong> <code>/etc/odbc.ini</code> <strong>:</strong></p>
  
  <pre><code>[PostgreSQL test]
  Description         = PostgreSQL 
  Driver              = PostgreSQL ANSI
  Trace               = No
  TraceFile           = /tmp/psqlodbc.log
  Database            = template1
  Servername          = localhost
  UserName            =
  Password            =
  Port                =
  ReadOnly            = Yes
  RowVersioning       = No
  ShowSystemTables    = No
  ShowOidColumn       = No
  FakeOidIndex        = No
  ConnSettings        =
  </code></pre>
  
  <p><strong>File</strong> <code>~/.odbc.ini</code><strong>:</strong></p>
  
  <pre><code>[DEFAULT]
  Driver = PostgreSQL
  
  [PostgreSQL]
  Description         = Test to Postgres
  Driver              = PostgreSQL
  Trace               = Yes
  TraceFile           = sql.log
  Database            = nick
  Servername          = localhost
  UserName            =
  Password            =
  Port                = 5432
  Protocol            = 6.4
  ReadOnly            = No
  RowVersioning       = No
  ShowSystemTables    = No
  ShowOidColumn       = No
  FakeOidIndex        = No
  ConnSettings        =
  </code></pre>