title: Insert data from file into database
body: <p>I have a .sql file with multiple insert statements ( 1000 + ) and I want to run the statements in this file into my Oracle database. </p>
  
  <p>For now, im using a python with odbc to connect to my database with the following:</p>
  
  <pre><code>import pyodbc
  from ConfigParser import SafeConfigParser
  
  def db_call(self, cfgFile, sql):
  
      parser = SafeConfigParser()
      parser.read(cfgFile)
      dsn = parser.get('odbc', 'dsn')
      uid = parser.get('odbc', 'user')
      pwd = parser.get('odbc', 'pass')
  
      try:
          con = pyodbc.connect('DSN=' + dsn + ';PWD=' + pwd + ';UID=' + pwd)
          cur = con.cursor()
          cur.execute(sql)
          con.commit()
  
      except pyodbc.DatabaseError, e:
              print 'Error %s' % e
              sys.exit(1)
  
      finally:
  
          if con and cur:
              cur.close()
              con.close()
  
  with open('theFile.sql','r') as f:
      cfgFile = 'c:\\dbinfo\\connectionInfo.cfg'
      #here goes the code to insert the contents into the database using db_call_many       
      statements = f.read()
      db_call(cfgFile,statements)
  </code></pre>
  
  <p>But when i run it i receive the following error:</p>
  
  <pre><code>pyodbc.Error: ('HY000', '[HY000] [Oracle][ODBC][Ora]ORA-00911: invalid character\n (911) (SQLExecDirectW)')
  </code></pre>
  
  <p>But all the content of the file are only:</p>
  
  <pre><code>INSERT INTO table (movie,genre) VALUES ('moviename','horror');
  </code></pre>
  
  <h1>Edit</h1>
  
  <p>Adding <code>print '&lt;{}&gt;'.format(statements)</code> before the db_db_call(cfgFile,statements) i get the results(100+):</p>
  
  <pre><code>&lt;INSERT INTO table (movie,genre) VALUES ('moviename','horror');INSERT INTO table (movie,genre) VALUES ('moviename_b','horror');INSERT INTO table (movie,genre) VALUES ('moviename_c','horror');&gt;
  </code></pre>
  
  <p>Thanks for your time on reading this.</p>