【发布时间】:2013-02-22 07:57:27
【问题描述】:
--> 好的,我在 SD 卡中有一个 Sql-lite 数据库。
(String DB_PATH = Environment.getExternalStorageDirectory().getPath().toString();)
--> 检查数据库是否存在
dbFile = new File(DB_PATH + DB_NAME );
if(dbFile.exists()== true)
{
//set text db exists
open_DB();
}
else
{
//set text db does not exist
return;
}
--> 在调试时我可以确认数据库文件的存在。但是当打开
数据库出现异常
SQLiteDatabase checkDB = null;
try
{
dbFile = new File(DB_PATH + DB_NAME);
myDataBase = SQLiteDatabase.openOrCreateDatabase(dbFile, null);
//myDataBase = SQLiteDatabase.openDatabase(DB_PATH + DB_NAME, null, 0);
//also tried this
//set text bd opened
}
catch(SQLiteException e)
{
//set text bd unable open
return;
}
【问题讨论】:
-
你得到了什么异常?
标签: java android database eclipse sqlite