title: Operational error : Unable to use a closed cursor Openerp 7
body: <p>When trying to create a database from the user interface, it shows: </p>
  
  <pre><code>Server Traceback (most recent call last):
    File "/opt/openerp/server/openerp/addons/web/session.py", line 89, in send
      return openerp.netsvc.dispatch_rpc(service_name, method, args)
    File "/opt/openerp/server/openerp/netsvc.py", line 296, in dispatch_rpc
      result = ExportService.getService(service_name).dispatch(method, params)
    File "/opt/openerp/server/openerp/service/web_services.py", line 122, in dispatch
      return fn(*params)
    File "/opt/openerp/server/openerp/service/web_services.py", line 168, in exp_create_database
      _initialize_db(self, id, db_name, demo, lang, user_password)
    File "/opt/openerp/server/openerp/service/web_services.py", line 98, in _initialize_db
      cr.close()
    File "/opt/openerp/server/openerp/sql_db.py", line 160, in wrapper
      raise psycopg2.OperationalError(msg) OperationalError: Unable to use a closed cursor.
  </code></pre>
  
  <p>The SQL connection is closed, but I don't know why.</p>
  
  <h2>Potential solution 1:</h2>
  
  <p>After further researche, I found that to be able to create the database from the user interface, you should perform the following configuration: </p>
  
  <p>In <code>openerp-server.conf</code>, you should put on <code>db_password</code>: the password for the role attributed to the <code>openerp</code> user. It's that role that gives the <code>openerp</code> user the ability to create databases from the user interface. If the two passwords do not match, you won't be able to create databases from the user interface.</p>
  
  <p>In my case, I found that my <code>openerp-server.conf</code> contained:</p>
  
  <pre><code>db_password : False,
  </code></pre>
  
  <p>I changed it to the password of the role given to the <code>openerp</code> user (<code>createdb</code>), I restarted the server but nothing changed. When trying to create the database from the user interface, the same error occurs.</p>
  
  <h2>Potential Solution 2:</h2>
  
  <p>I tried to create the database from psql by accessing postgres from the shell with the <code>openerp</code> user. I tried:</p>
  
  <pre><code>createdb db_name
  </code></pre>
  
  <p>The database is created, but I can't log in. I don't know how to attribute my database creation to an administrator account while performing <code>createdb</code>. The functional side of this potential solution is to be able to perform the same database creation process from the user interface as postgres.</p>
  
  <p>Can anyone give me a hand with these two potential solutions? I'm really struggling with this.</p>