title: Why the database can not be known in Android SQLite?
body: <p>I'm making an application Maps connected with SQLite which there are markers, but there is an error that the database can not be recognized, why did it happen? Can anybody help me? This my code :</p>
  
  <h2>MaBase.java</h2>
  
  <pre><code>public class MaBase  extends SQLiteOpenHelper {
  
      private static final String TABLE_MARK  ="marker.db";
      private static final String COL_ID = "ID";
      private static final String COL_LONG = "LONGITUDE";
      private static final String COL_LAT = "LATITUDE";
  
  
      private static final String CREATE_BDD = "CREATE TABLE " + TABLE_MARK  + " ("
      + COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COL_LONG + " TEXT NOT NULL, " +COL_LAT+" TEXT NOT NULL);";
  
  
  
  
  
  
      public MaBase (Context context, String name, CursorFactory factory, int version) {
          super(context, name, factory, version);
      }
  
      @Override
      public void onCreate(SQLiteDatabase db) {
          //on créé la table à partir de la requête écrite dans la variable CREATE_BDD
          db.execSQL(CREATE_BDD);
  
      }
  
      @Override
      public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
  
          db.execSQL("DROP TABLE " + TABLE_MARK + ";");
          onCreate(db);
      }
  
  }
  </code></pre>
  
  <h2>MainActivity.java</h2>
  
  <pre><code>public class MainActivity extends Activity {
  
      private static final String NOM_BDD = "marker.db";
      private static final String TABLE_GEOPOINT = "geopoint";
      private static final String COL_ID = "ID";
      private static final String COL_LONG = "LONGITUDE";
      private static final String COL_LAT = "LATITUDE";
  
      static final LatLng BOGOR = new LatLng(-6.604346, 106.796642);
      private GoogleMap map;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main_map);
  
          sauver_point();  
          map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
                  .getMap();
  
          MaBase maBaseSQLite = new MaBase(MainActivity.this, NOM_BDD, null, 1);
          SQLiteDatabase db = maBaseSQLite.getWritableDatabase();
          Cursor c = db.query(TABLE_GEOPOINT, new String[] { COL_ID, COL_LONG,
                  COL_LAT }, null, null, null, null, null, null);
          int col = c.getCount(); // col=0 pas de enregistrement qui verifie la
          // condition
          if (col == 0) {
              Toast.makeText(MainActivity.this, "Pas de donnees ",
                      Toast.LENGTH_LONG).show();
  
  
          } else {
              c.moveToFirst();
              while (c.isAfterLast() == false) {
                  // conversion int to string casting
                  String id = "" + c.getInt(0);
                  String longitude = c.getString(1);
                  String latitude = c.getString(2);
                  Marker marker = map.addMarker(new MarkerOptions()
                  .position(
                          new LatLng(Double.parseDouble(latitude),
                                  Double.parseDouble(longitude)))
                                  .title("Bonjour Tunis")
                                  .icon(BitmapDescriptorFactory
                                          .fromResource(R.drawable.mark2)));
                  c.moveToNext();
              }
          }
          c.close();
          db.close();
  
          map.moveCamera(CameraUpdateFactory.newLatLngZoom(BOGOR, 12.0f));
  
          // Zoom in, animating the camera.
          map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
          map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.activity_main, menu);
          return true;
      }
  
      void sauver_point() {
          MaBase maBaseSQLite = new MaBase(MainActivity.this, NOM_BDD, null, 1);
          SQLiteDatabase db = maBaseSQLite.getWritableDatabase();
          ContentValues values = new ContentValues();
          // values.put(COL_ID , "1");
          values.put(COL_LAT, "36.830722");
          values.put(COL_LONG, "10.165672");
  
          db.insert(TABLE_GEOPOINT, null, values);
  
          // creer un autre utilisateur
  
          values = new ContentValues();
          values.put(COL_LAT , "36.830922");
          values.put(COL_LONG, "10.275572");
          db.insert(TABLE_GEOPOINT, null, values);
  
          values = new ContentValues();
          values.put(COL_LAT, "36.930522");
          values.put(COL_LONG, "10.385572");
          db.insert(TABLE_GEOPOINT, null, values);
          values = new ContentValues();
  
          values.put(COL_LAT, "36.750422");
          values.put(COL_LONG, "10.495572");
          db.insert(TABLE_GEOPOINT, null, values);
  
  
          values.put(COL_LAT, "36.936422");
          values.put(COL_LONG, "11.495572");
          db.insert(TABLE_GEOPOINT, null, values);
  
          values.put(COL_LAT, "36.990422");
          values.put(COL_LONG, "9.995572");
          db.insert(TABLE_GEOPOINT, null, values);
  
          db.close();
  
      }
  
  }
  </code></pre>
  
  <h2>LogCat</h2>
  
  <pre><code>02-12 02:56:00.075: E/SQLiteLog(3453): (1) unknown database marker
  02-12 02:56:00.075: D/AndroidRuntime(3453): Shutting down VM
  02-12 02:56:00.075: W/dalvikvm(3453): threadid=1: thread exiting with uncaught exception (group=0xa6195908)
  02-12 02:56:00.075: E/AndroidRuntime(3453): FATAL EXCEPTION: main
  02-12 02:56:00.075: E/AndroidRuntime(3453): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.bongkorr/com.bongkorr.maps.MainActivity}: android.database.sqlite.SQLiteException: unknown database marker (code 1): , while compiling: CREATE TABLE marker.db (ID INTEGER PRIMARY KEY AUTOINCREMENT, LONGITUDE TEXT NOT NULL, LATITUDE TEXT NOT NULL);
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.os.Handler.dispatchMessage(Handler.java:99)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.os.Looper.loop(Looper.java:137)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.app.ActivityThread.main(ActivityThread.java:5041)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at java.lang.reflect.Method.invokeNative(Native Method)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at java.lang.reflect.Method.invoke(Method.java:511)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at dalvik.system.NativeStart.main(Native Method)
  02-12 02:56:00.075: E/AndroidRuntime(3453): Caused by: android.database.sqlite.SQLiteException: unknown database marker (code 1): , while compiling: CREATE TABLE marker.db (ID INTEGER PRIMARY KEY AUTOINCREMENT, LONGITUDE TEXT NOT NULL, LATITUDE TEXT NOT NULL);
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:882)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:493)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.database.sqlite.SQLiteProgram.&lt;init&gt;(SQLiteProgram.java:58)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.database.sqlite.SQLiteStatement.&lt;init&gt;(SQLiteStatement.java:31)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1663)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1594)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at com.bongkorr.maps.MaBase.onCreate(MaBase.java:31)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:252)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at com.bongkorr.maps.MainActivity.sauver_point(MainActivity.java:86)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at com.bongkorr.maps.MainActivity.onCreate(MainActivity.java:35)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.app.Activity.performCreate(Activity.java:5104)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
  02-12 02:56:00.075: E/AndroidRuntime(3453):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
  </code></pre>