Creat dabase in my application legato

Hello everyone,

Could you m’adader, I can not open my base to give to write in, Is it necessary access rights to open it knowing that I added the access rights in the file. adef

void databaseSQL::connectDb()
{

std::string initQuery = “CREATE TABLE IF NOT EXISTS LOG_APP_TABLE (EVENT_NO INTEGER PRIMARY KEY AUTOINCREMENT,TIME TEXT, LOG TEXT);”;
std::string journalMode = “PRAGMA journal_mode=PERSIST;”;
std::string resultSet;
int rc;
//acces to database

rc = sqlite3_open_v2(NEW_DATABASE, &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
if(rc)
{
  cout<<"[INFO/APPLICATION/STM] Can't open database:"<<sqlite3_errmsg(db)<<""<<strerror(errno)<<endl;
}
else
{
  cout<<"[INFO/APPLICATION/STM] Opened database successfully"<<endl;

  return;
}


if(this->doQuery(journalMode, &resultSet)!= SQLITE_ROW)
{
  cout<<"[INFO/APPLICATION/STM] Error for stopping journal"<<endl;;
    return;
}
int result = this->doQuery(initQuery,&resultSet);
if((result == SQLITE_OK) || (result == SQLITE_DONE))
{
  cout<<"[INFO/APPLICATION/STM] ===== Created the table LOG_APP_TABLE"<<endl;;
}
else
{
  cout<<"[INFO/APPLICATION/STM] ===== ERROR: Impossible create or access to table ====="<<endl;;
}


this->close();

}

int databaseSQL::doQuery(std::string query, std::string* resultSet){

sqlite3_stmt* statement;

if(this->db==NULL)
{
std::cout<<“[INFO/APPLICATION/STM]===== Connect to db =====”<<std::endl;
this->connectDb();
}
if(sqlite3_prepare_v2(db, query.c_str(), -1, &statement, NULL)==SQLITE_OK)
{
int result = sqlite3_step(statement);
switch(result)
{
case SQLITE_ROW:
{
cout<<“[INFO/APPLICATION/STM]===== Reading Params =====”<<endl;
resultSet->assign((char*)sqlite3_column_text(statement, 0));
break;
}
case SQLITE_DONE:
{
cout<<“[INFO/APPLICATION/STM]===== Query completed with success =====”<<endl;;
break;
}
default:
cout<<“[INFO/APPLICATION/STM] !!SQLITE error code[”<<endl;
}
return result;
}
else
{
std::cout<<“[INFO/APPLICATION/STM] [doQuery]”<<endl;
return -1;
}
}

Hi,

Could you share your adef file and also the Legato log showing the error?

BR
Jay

hi, am trying to insert value in table , i can able to insert values till 500 records with out any issue after that am getting an error no 14 i.e., unable to open the database file, can any one help me how to resolve the issue.

note:-Once i restart the unit i can able to insert again

have you tried to disable the “sandboxed” feature?

s disabled Sandboxed

have you compiled with toolchain and run it as simple linux application?
If it has same problem, that means it is not related to legato problem.