Recent

Author Topic: [SOLVED] sqlite EAccessViolation : Access violation  (Read 215 times)

senglit

  • Full Member
  • ***
  • Posts: 127
[SOLVED] sqlite EAccessViolation : Access violation
« on: September 10, 2022, 08:50:08 am »
hi, all

I am working on a program which works fine on windows10 and ubuntu22 x86_64. There is something like this:
Code: Pascal  [Select][+][-]
  1. var  
  2.   dbConn: TSQLite3Connection;
  3.   trans: TSQLTransaction;  
  4.   query: TSQLQuery;  
  5. ...
  6.  
  7. function connectToDB: boolean;
  8. begin
  9.   Result := False;
  10.   dbConn := TSQLite3Connection.Create(nil);
  11.   query := TSQLQuery.Create(nil);
  12.   trans := TSQLTransaction.Create(nil);
  13.   dbConn.DatabaseName := 'hy.db';
  14.   dbConn.LoginPrompt := False;
  15.   dbConn.Transaction := trans;
  16.   query.Transaction := trans;
  17.   try
  18.     trans.StartTransaction;   //    <-----this line
  19.   except              
  20.     query.Free;
  21.     trans.Free;
  22.     dbConn.Free;
  23.     exit;
  24.   end;
  25.   trans.Active := False;
  26.   updateSysItems;
  27.   Result := True;
  28. end;              
  29.  
I do this to check if the sqlite database can be accessed when program is starting up. And it always works.

Then I put this program on ubuntu18 armV7l, on which the program will really run in the future. First I built the program by fpc prj.pp, it looked ok and I got the executable file. But everytime when it goes to the line "trans.StartTransaction" I get an error message like:
    An unhandled exception occurred at $00000000:
    EAccessViolation: Access violation
    $00000000
    $0002EB60

The file hy.db is there and I can read the data by command "sqlite3 hy.db" via ssh terminal.

I didn't install lazarus but only FPC3.2.2 on ubuntu armV7l since it does not have a GUI. And I think since TSQLite3Connection is a component of fpc it should be ok.

What's wrong?
« Last Edit: September 10, 2022, 05:47:25 pm by senglit »
I use Win10 + Lazarus 2.2.0 + FPC 3.2.2. All 64bit.

senglit

  • Full Member
  • ***
  • Posts: 127
Re: sqlite EAccessViolation : Access violation
« Reply #1 on: September 10, 2022, 05:47:09 pm »
oh... I installed only sqlite3, without libsqlite3-dev.

After installed libsqlite3-dev problem solved.
I use Win10 + Lazarus 2.2.0 + FPC 3.2.2. All 64bit.

 

TinyPortal © 2005-2018