title: Failure to open database file Android NDK (Cocos2d-x)
body: <p>I'm having trouble opening a sqlite3 file by passing the directory of it to sqlite3_open().</p>
  
  <p>By logging the result, and the value of dbPath, it can be seen that sqlite does attempt to, and the file has been found. What I'm unsure about is if the format of dbPath is correct.</p>
  
  <p>The following code returns false, as result != SQLITE_OK, it equals SQLITE_CANTOPEN instead.</p>
  
  <pre><code>//load from the Data/ directory (or assets/ if android)
  std::string dbPath = CCFileUtils::getInstance()-&gt;fullPathForFilename("molemioDB.sql");
  
  result = sqlite3_open(dbPath.c_str(),&amp;pDB);
  
  //failed to open database?
  if (result != SQLITE_OK){
      CCLOG("ERROR: Failed to open database: %i", result);
  
      return false;
  }
  </code></pre>
  
  <p>Result has a value of 14, and from sqlite3.h:</p>
  
  <pre><code>#define SQLITE_CANTOPEN    14   /* Unable to open the database file */
  </code></pre>
  
  <p>And dbPath's value is shown after using a MessageBox to display it. It equals:</p>
  
  <pre><code>"assets/molemioDB.sql"
  </code></pre>
  
  <p>Why does this happen? The database file is inside the assets file in proj.android. And, also in the Data/ folder in the highest directory on my computer - although this is for the iOS version, which loads the database perfectly fine.</p>
  
  <p>A few things to note is that the database is obviously precreated, using a python script I had written. The permissions for the molemioDB.sql file is 644, although the database is only read.</p>
  
  <p>Thanks in advance.</p>