0

I created an android project in Android Eclipse and I want to connect to the database I've created in SQLite Manager.

The database will be saved locally. It is basically a read only only app, there are no create delete update actions done by the user. My queries will be a lot of select queries. I have my data base made and want to import it into android project. What are the steps? I have my model classes created. What else do I need in order to have to connected? Do I store the SQLite file in the assets folder etc?

I have the database made in the firefox addon SQLite Manager!

userC22
  • 31
  • 1
  • 10
  • @DerGolem I looked at that and it isn't what I am looking for – userC22 Jan 23 '15 at 14:52
  • `I want to connect to the database I've created in SQLite Manager. The database will be saved locally.` It really **is** the classical use case for: copying the db from the `asset` folder to the `/data/data/...` path. – Phantômaxx Jan 23 '15 at 14:54
  • And when I have it copied what are the steps then? I have the model classes created, what else do I need? many thanks @DerGolem – userC22 Jan 23 '15 at 15:00
  • Once the db is copied in place (only if not yet existing!!) then simply open it and use it (queries only, if I understood - you don't perform commands, since it's read-only). Then close it. – Phantômaxx Jan 23 '15 at 16:09

2 Answers2

0

DB browser is tool for create database and you should connect from your app to this databese. I'am not sure in what point is your app with working with database? Perhapse this tutoriol will help you enter link description here

kolo
  • 85
  • 1
  • 1
  • 9
  • I would like to connect database I have created to my project on eclipse and I would like to know the steps involved for this? thank you – userC22 Jan 06 '15 at 15:55
  • Ok, but you have to put your databese on the device eclipse has nothing to do with this. But i think you should put your databese on some server and from app generate ask to server/databese. If you want to put databese in app, so if someone will get app and install on the device so databese must be generated durning first start app. I think (i don't do this) you can tray generate some xml from your database and put this file to project. Then after new install app on the device app must generate databese base on this xml. I think is better do this on server and app only connect with database. – kolo Jan 06 '15 at 16:07
  • Sorry but I have no idea what you mean? – userC22 Jan 06 '15 at 16:10
  • Where you want keep your databese? On some server and connect from app? Or on the device? – kolo Jan 06 '15 at 16:18
  • I though SQLite was a server less database? @Kolo – userC22 Jan 06 '15 at 16:20
  • Yes sqLite is "server" but i understand you have databese created and want to attache to the app? Maybe this will help you [link] http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/[/link] – kolo Jan 06 '15 at 16:24
  • When I clicked that link it gave a 404 error! – userC22 Jan 10 '15 at 14:39
0

You can take a look at these tutorials on SQLite topic, i recently built a swing application for a client and I found these very informative.

It contains a lot of information about the connnection to the actual SQLite database, queries, and how to do each query step by step.

You may want to take a look at java docs as well if you run into any kind of problem.

Hope i helped.

P.S I also used the SQLite Manager mozilla add-on for this, i had no trouble.

Voqus
  • 159
  • 1
  • 11