title: Why "failed to chmod "would happen?
body: <p>my code for copying sqlite database to assets folder is like this . but something went wrong . `private Context context;
          private String db_path;</p>
  
  <pre><code>/*public static final String CREATE_TABLE="CREATE TABLE " + 
              TABLE_NAME +"  ("+
      KEY_ID+" INTEGER PRIMATY KEY AUTOINCREMENT, "+
      KEY_USERNAME+" INTEGER NOT NULL, "+
      KEY_PASSWORD+" VARCHAR NOT NULL, "+
      KEY_HOMEADDRESS+" VARCHAR, "+
      KEY_LICENSENO+" VARCHAR );";*/
  </code></pre>
  
  <p>My DbHelper class is</p>
  
  <pre><code>public DbHelper(Context context){
      super(context,"DATABASE_NAME",null,DATABASE_VERSION);
      this.DATABASE_NAME=DATABASE_NAME;
      this.context=context;
      db_path="/data/data/"+context.getPackageName()+"/databases/";
  }
  
  //create an empty database on the system to rewrite
  public void crearDataBase() throws IOException{
      boolean dbExists=checkDataBase();
      if(dbExists){
  
      }else{
          this.getReadableDatabase();
          try{
              copyDataBase();
          }catch(IOException e){
              throw new Error("Error copying databse");
          }
      }
  }
  
  private boolean checkDataBase(){
      SQLiteDatabase checkDB=null;
      try{
          String myPath=db_path+DATABASE_NAME;
          checkDB=SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);
      }catch(SQLiteException e){
  
      }
      if(checkDB!=null){
          checkDB.close();
      }
      return checkDB!=null?true:false;
  }
  
  //copy database from local asset-folder to the system folder
  private void copyDataBase() throws IOException{
      //open local database as the input stream
      InputStream myInput=context.getAssets().open(DATABASE_NAME);
  
      //path to the just created empty database
      String outFileName=db_path+DATABASE_NAME;
  
      //open the emoty database as the output stream
      OutputStream myOutput=new FileOutputStream(outFileName);
  
      //transfer bytes from the input file to the output file
      byte[] buffer=new byte[1024];
      int length;
      while((length=myInput.read(buffer))&gt;0){
          myOutput.write(buffer,0,length);
      }
      //close the streams
      myOutput.flush();
      myOutput.close();
      myInput.close();
  }
  
  /*public void openDataBase() throws SQLException{
      //open the database
      String myPath=db_path+DATABASE_NAME;
      myDataBase=SQLiteDatabase.openDatabase(mypath, null,SQLiteDatabase.OPEN_READONLY); 
  
  }*/
  
  
      @Override
      public void onCreate(SQLiteDatabase db) {
          //db.execSQL(CREATE_TABLE);
      }
  
  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
      //delete table
      db.execSQL(DROP_TABLE);
      onCreate(db);
  
      }`  
  </code></pre>
  
  <p>and the log cat is like this :</p>
  
  <pre><code>05-08 04:24:31.644: D/dalvikvm(7015): GC_FOR_ALLOC freed 124K, 6% free 3242K/3440K, paused 40ms, total 42ms
  05-08 04:24:32.134: D/gralloc_goldfish(7015): Emulator without GPU emulation detected.
  05-08 04:25:42.644: I/Choreographer(7015): Skipped 62 frames!  The application may be doing too much work on its main thread.
  05-08 04:25:45.244: W/FileUtils(7015): Failed to chmod(/data/data/com.example.login/databases/DATABASE_NAME): libcore.io.ErrnoException: chmod failed: EPERM (Operation not permitted)
  </code></pre>
  
  <p>The application could work on the emulator, but not on the phone.<br>
  Also, my phone does not have a SD card, is that ok for an external sqlite database?</p>