Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to access and open an existing SQLite database (in Eclipse/Emulator)

 
Chris Trout
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created and loaded a small database via the SQLite3 command line tool.
I am developing in Eclipse and using the emulator to test with.
I would like to know what the accepted practice is for where to put the database in my Eclipse Android project folder structure, and how to access it in my java code.
It would also be good to know how to test for the existence of the database file before trying to open it as I think the method will create it if it doesn't exist and I don't want that.

Thank You in advance to those wishing to reply.

-Chris
 
Chris Trout
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been doing some research on this question and I'm wondering if any SQLite database used in an Android application needs to be created via the application code.
For example, if I create the database and load it ahead of time (which is typically what is done with a db used exclusively for look-up tasks) and place it in the "assets" folder of my Eclipse/Android project structure, do I need to open that file and read it byte-by-byte into a new (db) file I create.
From there I'm thinking I would use existing SQLite methods to open and access the db.

Any assistance on how to do this would be greatly appreciated.

Thanks
-Chris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic