Not creating the .db file in cellphone

before build and install the apk in the cellphone, it doesns create the data.db file but it does in the CoronaSimulator

in the code i have the line

local path = system.pathForFile( “data.db”, system.DocumentsDirectory )

and tried with this settings in the build.settings file

android =
usesPermissions =

Hi Darco, we’ll probably need more information…

Are you getting any errors? How are you verifying the file is not being created?
What’s your code for creating the file, and for reading the file?

This is the initial block of code,
the system.pathForFile is supposed to create the file right?

local settings = require( ‘settings’ )

local sqlite3 = require( ‘sqlite3’ )
local json = require( ‘json’ )
local syncLib = require( ‘libs.sync’ )

local path = system.pathForFile( “data.db”, system.DocumentsDirectory )
local db = path )

local function onSystemEvent( event )
if event.type == ‘applicationExit’ then

function _M.init()
for i = 1, #info do
local columns = table.concat( info[i][‘COLUMNS’], ', ’ )
local query = [[CREATE TABLE IF NOT EXISTS ]] … info[i][‘TABLE_NAME’] … [[(]] … columns … [[);]]
db:exec( query )

I did some test using the sample code from the documentation….

The first problem is that will create a new db file if none exists, and it doesn’t tell you if it was able to open an existing file or if it created a new one.

Here’s some code you can use to test with:

local sqlite3 = require( "sqlite3" )
local lfs = require("lfs")
local path = system.pathForFile( "data.db", system.DocumentsDirectory )

local fileInfo = display.newText("File info:", 0, 20, nil, 10)
	fileInfo.anchorX = 0
	fileInfo.anchorY = 0
local function createDB()
	local db = path )
		  CREATE TABLE test (id INTEGER PRIMARY KEY, content);
		  INSERT INTO test VALUES (NULL, 'Hello World');
		  INSERT INTO test VALUES (NULL, 'Hello Lua');
		  INSERT INTO test VALUES (NULL, 'Hello Sqlite3')
local function checkDBFile()
	local file =, "rb")
	if not file then
		fileInfo.text = "data.db Not found."
		return false
    local size = file:seek("end")    -- get file size
	fileInfo.text = "data.db found with size of size: " .. size
	return true

if not checkDBFile() then
	fileInfo.text = "Created new data.db."

-- read db content
local db = path )
for row in db:nrows("SELECT * FROM test") do
  local t = display.newText( row.content, 20, 50*, nil, 16 )
  t:setFillColor( 1, 0, 1 )

i did an update to the solar2d in my computer and some changes and it worked, but now it work in some devices, like mine and my boss’s device, anyone else’s it doesn’t upload

What did you update, the db or the app?

If it’s the db, are you updating it with queries or replacing the db file?

Also, what path are you using to store the db?

A little of a few things
i’d need a new access token in laravel, i was using an already used one

local path = system.pathForFile( settings.DATABASE.DATABASE_NAME … ‘.db’ or ‘data.db’, system.DocumentsDirectory )

but the thing that annoys me is the thing that i can upload in my device but other people no
can be the “developers mode” in android? or im just crazy?

Not really sure what you mean by uploading, but either way, you’ll definitely need to be able to replicate the issue on your side or get some logs from the other devices with meaningful output, otherwise you’ll just be guessing what the issue could be.