Extracting data from a .db file thats on a server.

Hi All

Apologises if this is the wrong area to post such a newbie question but here it goes. I’ve just started using Corona and I’m trying to extract a cell(s) from a database that’s on one of our servers. Looking at some of the tutorials I tried to come up with my own function that would extract a record from a database which is shown below:

function readRecord()

require “sqlite3”

local path = system.pathForFile(“test_database.db” , system.DocumentsDirectory)
local db = sqlite3.open(path, “w+b”)

http.request
{
url = <server_path>, -----> <server_path would be the url to database on server>
sink = ltn12.sink.file(myFile),
}

for row in db:nrows(“SELECT * FROM test”)do
local t = display.newText(row.content, 100, 50 * row.id, null, 16)
end
end

I know the above code is probably all wrong but all i want to do is:

1. Access the database on a server by giving the URL to the database file on the server.
2. Search / access a cell from the database.
3. Display the contents of that cell onto the screen.

I know the code i wrote above tries to make a copy of the database on the iPhone (local path = system.pathForFile(“test_database.db” , system.DocumentsDirectory)); I don’t want to do that but i thought if i could make a copy of the database on the iphone and then display it to the screen at least that would be a step in the right direction.

If you could assist me with this issue that would be thoroughly appreciated.

Thank you for your time

Christian [import]uid: 147081 topic_id: 27719 reply_id: 327719[/import] </server_path></server_path>