Hi Simon,
Thanks very much for getting back to me.
You wrote -
"Specify the full path of your file when you open the file. For example
"/assets/databases/events.db"."
That is my problem, I don't know how to do that.
Based on my current [limited] understanding of how Android opens a sqllite db,
when I create my EventsData object the constructor for it
will be called:
public EventsData(Context ctx) {
super (ctx, DATABASE_NAME , null , DATABASE_VERSION );
}
[ I do not know what the "null" parm is....] Possibly the path for the db??
Then since I have not changed the version number the OnUpgrade() method in the
EventsData obj will not be called ( the tbl will not be dropped and created ).
Snce the db is going to be created the 1st time thru the OnCreate() method s/b
called to create the only tbl.
public EventsData(Context ctx) {
super (ctx, DATABASE_NAME , null , DATABASE_VERSION );
}
[ I do not know what the "null" parm is....] Possibly the path for the db??
Then since I have not changed the version number the OnUpgrade() method in the
EventsData obj will not be called ( the tbl will not be dropped and created ).
Snce the db is going to be created the 1st time thru the OnCreate() method s/b
called to create the only tbl.
super (ctx, DATABASE_NAME , null , DATABASE_VERSION );
}
[ I do not know what the "null" parm is....] Possibly the path for the db??
Then since I have not changed the version number the OnUpgrade() method in the
EventsData obj will not be called ( the tbl will not be dropped and created ).
Snce the db is going to be created the 1st time thru the OnCreate() method s/b
called to create the only tbl.
}
[ I do not know what the "null" parm is....] Possibly the path for the db??
Then since I have not changed the version number the OnUpgrade() method in the
EventsData obj will not be called ( the tbl will not be dropped and created ).
Snce the db is going to be created the 1st time thru the OnCreate() method s/b
called to create the only tbl.
The next thing that happens is I get a r/w handle to the db.
// get a read/write handle to the db
SQLiteDatabase db = events .getWritableDatabase(); events
.getWritableDatabase();
I've attached 3 small files that comprise the entire app if you would like to
take a look.
The app runs fine. If I can understand how to create the db where I want it I
can prob determine how to open an existing db from the place where I store it.
Thanks again for you assistance.
-Chris
----- Original Message -----
From: "Simon Slavin" <[email protected]>
To: "General Discussion of SQLite Database" <[email protected]>
Sent: Friday, July 2, 2010 2:18:52 PM
Subject: Re: [sqlite] working with existing (look-up) database
in Android/Eclipse
On 2 Jul 2010, at 9:00pm, [email protected] wrote:
> I then created a sub-folder in my Eclipse Android project structure under the
> "assets" folder and named it "databases".
>
> Is this the correct place to put a database file?
You can put your database file anywhere you have read/write privilages. SQLite
just reads and writes to that file using standard commands. It does not insist
that all your database files are in a particular folder.
> My bigger question is - how do I get to it?
Specify the full path of your file when you open the file. For example
"/assets/databases/events.db".
> As a side question, I have successfully worked thru the sqlite db example in
> the Hello, Android book starting on p. 170 but can't seem to find the
> events.db file anywhere.
If you specified just the filename and no path, then you may not know where
your application put that file. Use the facilities of your computer to search
for any file with the right name, or just forget that one and specify a full
path in future.
Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users