语言

Menu
Sites
Language
How to load database created in sqlite browser?

I have been created .db file in sqlite browser. Now i want to load its data in my application.
So how to make connection to this .db database??? Will anyone help me?

编辑者为: bhoomika rathod 01 10月, 2017

响应

3 回复
Armaan-Ul- Islam

Hello,

I would suggest "Complete tutorial for sqlite database CRUD operation and data access from Tizen native application" by Mohammad Nur Nobi. Seems pretty good to me.

 

In your case As you want to work with a '.db' file, that is already created, Keep your '.db' file on '/res' directory which is the default directory to keep application resources in Tizen File system. I hope after reading these post & Guide you would understand my hint.

Access to /data folder

File System Directory Hierarchy

 

What you have to do is in opendb() function to open database instance, (Sqlitedbhelper.c file in the guide mentioned):

Replace app_get_data_path() with app_get_resource_path() to get the application resource directory path.

 

Hope this will fix the Issue. In case, If you face difficulties in modifying db while keeping it in 'res' folder, then copy the sqlite database instance to data path from resource path first using C code in your application.

bhoomika rathod

i have data.db in res folder and i want to copy it in shared/data folder at runtime.
first i opened data.db from res and then opened another data2.db in shared/data.
Now i want to copy data.db in data2.db. How to do this ???

Armaan-Ul- Islam

I've shared a code snippet here on this link for copying '.db' file to 'shared/data' folder from 'res' folder at runtime.

https://developer.tizen.org/forums/native-application-development/how-copy-sqlite-data.db-file-application-runtime#comment-25969

 

Please Share your feedback.