title: PDO PHP SQLite3 database connection General Error 14
body: <p>I have 2 sqlite3.x databases (from an iPhone), one from a game app, and the other is the address book.</p>
  
  <p>I have logging and display errors 'on' in the php conf.</p>
  
  <p>Using PHP/PDO I can display the fields and values from the game database, including image blobs which I catch with my results page and render with "img src='data:...'.  I'm using htmlentities on other fields to catch things like plist binary blobs.</p>
  
  <p>I'm using a perl script to generate the first page, and the sample data is obtained using a system call to sqlite3.  The script is doing a recursive search through a directory provided as a cli argument.</p>
  
  <p>I basically get the first record from each table within a database (as a data sample), give the user options on which fields they want to further interrogate, and pass those options to a form handler which executes the query against the target table, and getting data from the chosen columns.</p>
  
  <p>However...I get a "unable to open database" general error when trying to connect to the addressbook database.</p>
  
  <p>I have checked the database permissions, ownership, put both in the same directory, made them fully open to the world..everything I can think of, and still no joy.</p>
  
  <p>What's really odd is that I can query all databases quite happily from the commandline with sqlite3, but get this error when using PDO.</p>
  
  <p>The whole things trips up at the following:</p>
  
  <pre><code>($db and $strSQL vals passed from previous page)
  
  $dbh = new PDO('sqlite:'.$db);
  $dbh-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
  $result = $dbh-&gt;query($strSQL);
  </code></pre>
  
  <p>Even if I select a simple primary key column from the table, I get the error, so I'm pretty sure it's not a data handling problem.  I've even tried this same script against Firefox and Chrome databases...no problems at all.</p>
  
  <p>Would really appreciate any ideas/pointers/suggestions.  This one is doing my head in!</p>
  
  <p>Cheers.</p>