How do you open a remote sqlite database over http

2019-08-02 06:34发布

问题:

Is it possible to open an sqlite file over http? I only need to read the db, and was hoping I could do something like:

var dbFile:File = new File("http://10.1.1.50/project/db.sqlite");
sqlConnection.open(dbFile);

Error #3125: Unable to open the database file.', details:'Connection closed.', operation:'open', detailID:'1001'

My situation calls for several apps compiled for various devices to share this file, which is served locally via wamp.

回答1:

Zip your sqlite file from db.sqlite to db.zip. Load this zip file in flex using URLLoader and unzip it back in flex.

If not, you can also rename the file's extension to .xml, load it using httpservice or urlloader and once you get the result, you can rename the file's name back to .sqlite and start querying the file and it will work just fine.



回答2:

There is no way you can achieve this over HTTP. SqLite is a file and not a service/process that may be accessible via any port.

The best case scenario is when you have network access to the computer where the sqlite file is stored, like:

\\myserver\databases\mysqlitefile.db

...but this may work only on windows :(



回答3:

You can adapt your code to use modsqlite http://modsqlite.sourceforge.net/#using



回答4:

there's an apache module to allow remote sqlite access via http.

http://modsqlite.sourceforge.net/