首页 > 后端 > 知识 > android生成的数据库在哪个文件夹,Android 中创建的数据库文件默认放在那里的

android生成的数据库在哪个文件夹,Android 中创建的数据库文件默认放在那里的

来源:整理 时间:2024-08-22 20:24:52 编辑:黑码技术 手机版

本文目录一览

1,Android 中创建的数据库文件默认放在那里的

默认路径是/data/data/然后是你创建的包名,然后就找到你创建的数据库名字了
在根文件夹下的 /data/data/your package name/database/xxx.db下面。推荐用re浏览器访问。还可以直接查看数据库文件。另外这里有安卓4.0目录结构的介绍。http://blog.sina.com.cn/s/blog_c92f7b180101dtsw.htmlSQLite,是一款轻型的数据库,是遵守ACID的关系型数据库管理系统,它包含在一个相对小的C库中。它是D.RichardHipp建立的公有领域项目。它的设计目标是嵌入式的,而且目前已经在很多嵌入式产品中使用了它,它占用资源非常的低,在嵌入式设备中,可能只需要几百K的内存就够了。它能够支持Windows/Linux/Unix等等主流的操作系统,同时能够跟很多程序语言相结合,比如 Tcl、C#、PHP、Java等,还有ODBC接口,同样比起Mysql、PostgreSQL这两款开源的世界著名数据库管理系统来讲,它的处理速度比他们都快。
是的,找你创建工程的时候 写的那个包名下面的 database 下
在data/data/你程序的包/database你不把手机root是看不了的。

Android 中创建的数据库文件默认放在那里的

2,android 中的数据库存在在工程中的哪个目录下

Android中有内置的数据库SQLite,其默认存储位置是在:标题栏中Window->show view->File Exporer->data/data/应用项目的包名,例如:假如有一个操作Android SQLite数据库的应用包名为com.example.xutilsdemo,那么其内置的数据库的存储位置即为:/data/data/com.example.xutilsdemo/databases/xxx.db
一般在 data/data/com.xxx.xxx/databases目录下这个必须要运行之后才会自动创建。你最好跟下代码,看代码里有没有一个类继承SqliteOpenHelper,如果有这个只要app一打开就会创建。另外很多真机确实限制了data/data目录的访问权限,如果是这样的话也可以root一下。最好还是先跟下代码
存在res/raw/ 下面,然后程序启动的时候再把这个文件考到sd卡下,然后才能使用sqlite进行连接追问:sld=SQLiteDatabase.openDatabase ( "/data/data/com.bn.fkdp/mydb", //数据库所在路径 null, //CursorFactory SQLiteDatabase.OPEN_READWRITE|SQLiteDatabase.CREATE_IF_NECESSARY //读写、若不存在则创建 ); 这是本人参考的一个程序中的数据库 本人想新建一个但是我在它的工程中怎么找不到"/data/data/com.bn.fkdp/mydb", 这个路径啊 请大侠指点一下追答:在DDMS里应该是可以找到那个路径的,如果是用模拟器运行的话。
楼上的是垃圾!存在res/raw/ 下面,然后程序启动的时候再把这个文件考到sd卡下,然后才能使用sqlite进行连接

android 中的数据库存在在工程中的哪个目录下

3,android 数据库文件存在哪里

1、运行输入 adb shell (前提是模拟器正在运行) 2、进入命令界面后 输入 ls 指令 会列出文件的目录 3、cd 进入想要的目录里 4、一层一层进去后会发现 databases目录 数据文件就在这个目录下放着 5、sqlite3 test (test就是创建的数据库的名称 注意:不要加.db 后缀) 6、现在就进入创建的test数据库了使用 .tables 就可以查看所有的表了
// 检查数据库是否有效 private boolean checkdatabase() // sqlitedatabase checkdb = null; // string mypath = db_path + db_name; file file = new file(db_path, db_name); return file.exists(); } public dbctrl(context context) super(); synchronized (lock) this.context = context; db_path = context.getresources().getstring(r.string.dbpath); boolean dbexist = checkdatabase(); if (dbexist) // 数据库已存在,do nothing. } else // 创建数据库 try file dir = new file(db_path); if (!dir.exists()) dir.mkdirs(); } file dbf = new file(db_path + db_name); if (dbf.exists()) dbf.delete(); } // sqlitedatabase.openorcreatedatabase(dbf, null); // 复制asseets中的db文件到db_path下 copydatabase(); } catch (ioexception e) throw new error("数据库创建失败"); } } } } private void copydatabase() throws ioexception // open your local db as the input stream inputstream myinput = context.getresources() .openrawresource(r.raw.db); // path to the just created empty db string outfilename = db_path + db_name; // open the empty db as the output stream outputstream myoutput = new fileoutputstream(outfilename); // transfer bytes from the inputfile to the outputfile byte[] buffer = new byte[1024]; int length; while ((length = myinput.read(buffer)) > 0) myoutput.write(buffer, 0, length); } // close the streams myoutput.flush(); myoutput.close(); myinput.close(); // } }我用的这个 构造 helper时候没有数据库就复制了 我觉得你失败的原因不是复制有问题而是数据太大了android2.3以前不能直接读大于1m的资源的你把数据库分割成小块复制过来时拼起来吧
默认路径是/data/data/然后是你创建的包名,然后就找到你创建的数据库名字了

android 数据库文件存在哪里

文章TAG:android生成生成的数据android生成的数据库在哪个文件夹中创建的数据库文件默认放在那里的

最近更新