SQLite Database in Project


#1

Because I required a very large database in my old projects I used an App Studio application to create a database and the working application actually used that database. It was pretty simple then, but now I can’t seem to do that with the newer version. I keep getting error message reading that the table doen’t exist. I noticed that now there seems to be separate folder for each database in Chrome. I looked through the documentation and tried to set the path in the manifest, but no luck. The simple answer might be to just explain the best way and any additional files required to load a database into an application. I am soory if that is documented but I couldn’t find it.


#2

I don’t know ih I can help you… But I had the same problem today. When I inserted a sqlite file named “test.sqlite3” it didn’t work. But when I renamed the file to test.db and inserted again it worked. The difference after inserting was also that the icon of the db-file was a barrel (database) and when I inserted the *.sqlite3 file the icon was with bracets.
Please try to rename the database file and try again.


#3

Where are you seeing the separate databases in Chrome?

I’m not aware of anything which has changed in AppStudio which would cause this.


#4

Myself I was not successfull by adding databases to the manifest. I had to drag my *.db files (not *.sqlite3 file ending) to the project explorer. Than there was a .js file created and included to the project which worked fine. Maybe there is another way to include databases without the generation of .js files of it. But I don’t know how either.


#5

To all,
Thanks for the help. Sorry for being tardy with my reply, but I was traveling for two days and then came home sick and I just recovered this morning.
I don’t remember this happening in older versions, but I assumed it was happening because I read somewhere that newer versions of Chrome do not allow apps to access another App’ s databases.

These are three new files created by the database app that creates the database:
http_127.0.0.1_64238,
http_127.0.0.1_56762,
http_127.0.0.1_56541

Their location is : C:\Users\Alan\AppData\Local\Google\Chrome\User Data\Default\databases\http_127.0.0.1_64238

Every time I run the app to create the database I get a new folder with another database in it despite the code:

sqlList[0]=["CREATE TABLE IF NOT EXISTS " & "MatchDataA(id INTEGER PRIMARY KEY, ‘FirstName’, ‘SecondName’, ‘Date’, ‘StatTaker’, ‘OppName’, "_

I tried accessing each one with the app that would actually use the database, and it seems no matter what I do I cannot access it with a different program. I placed this file location in the CACHE MANIFEST in USER FILES. (Is that the proper place?)

USER FILES

C:\Users\Alan\AppData\Local\Google\Chrome\User Data\Default\databases\http_127.0.0.1_64238\5
(5 being the actual database)

Thank you for the advice above regarding renaming, I will try it today. (I am not sure I actually understand it, but I will work at it!) I thought there was an accepted method to actually include an SQLite DB into a project, so I also plan to look through the AppStudio documentation for how to actually insert a database into an app. I couldn’t find it on my first try, but I will look further now that I am feeling better. I also remember reading something that using C: drive as a location will not work in browsers, so I will look into that.
Thanks again,
alan


#6

I would not rely on accessing the databases using the regular file system. They’re meant to be inside Chrome’s sandbox, where other apps cannot affect them.


#7

Leader,
That address is the file where my App Studio created the database - it was not where I put it.
alan


#8

When AppStudio creates a database, Chrome saves it in its own internal sandbox. It is not meant to be accessed from the Windows file system.


#9

Leader,
I am not trying to access it through a Windows app. I am trying to access it through another Chrome app. But that address above is where AppStudio put the database, so that must be the Chrome Sandbox, correct?
alan


#10

AppStudio doesn’t put it anywhere - that’s under Chrome’s control.

One of the purposes of the sandbox is to make sure rogue web pages cannot access data in databases which don’t belong to them. I think the only case where is is allowed is if they both come from the same server.