I used this code to create a table in the documents directory and acces the data. Works fine for me. 
If you need to use an existing table I think you can just add it to you project directory but then you only have read-access to the file. If you need to update the data you need to copy the table to the documents directory. I don’t know how to do that but the code below should work for creating a new table and access the records in the table.
require "sqlite3"
local path = system.pathForFile( "data.db", system.DocumentsDirectory )
local db = sqlite3.open( path )
local tablesetup = [[CREATE TABLE IF NOT EXISTS events (id INTEGER PRIMARY KEY autoincrement, titel, year, month, day, hh, mm, link);]]
db:exec( tablesetup )
-- Close database on exit
local function onSystemEvent( event )
if event.type == "applicationExit" then
if db and db:isopen() then
db:close()
end
end
end
Runtime:addEventListener( "system", onSystemEvent )
-- Then read the data
local sEvents = {} -- starts off emtpy
for row in db:nrows("SELECT \* FROM events ORDER BY year, month, day")
-- Fill events
sEvents[#sEvents+1] =
{
order = #sEvents+1,
id = row.id,
titel = row.titel,
year = row.year,
month = row.month,
day = row.day,
hh = row.hh,
mm = row.mm,
link = row.link
}
end
You can also check this blogpost: http://www.coronalabs.com/blog/2012/04/03/tutorial-database-access-in-corona/ [import]uid: 98060 topic_id: 31618 reply_id: 126289[/import]