title: Share sqlite2 database with Yii webapp
body: <p>Hi I've got a sqlite2 database that is being used by a PHP webapp and I want a Yii webapp to access it. At the moment I copied the db file to a local server and I've changed config/main.php to:</p>
  
  <pre><code>        'db'=&gt;array(
          'connectionString' =&gt; 'sqlite:'.dirname(__FILE__).'/../data/thedatabase.db',
      ),
  </code></pre>
  
  <p>When I run the Gii model generator I get:</p>
  
  <pre><code>CDbException
  
  CDbCommand failed to execute the SQL statement: CDbCommand failed to prepare the SQL statement: SQLSTATE[HY000]: General error: 26 file is encrypted or is not a database. The SQL statement executed was: SELECT DISTINCT tbl_name FROM sqlite_master WHERE tbl_name&lt;&gt;'sqlite_sequence'
  </code></pre>
  
  <p>BTW I am able to convert the database to SQL using</p>
  
  <p><a href="https://stackoverflow.com/questions/11443249/exporting-sqlite2-database-to-sql">Exporting sqlite2 database to SQL</a></p>
  
  <p>Though I want the database to stay as an sqlite2 database so that the Yii app can access up to date user info.</p>