Program drops at database open lazarus / 16-Databases ---------------------------------------------------------------------- iwilson · 2011-11-16 14:40 CallDB := TSQLite3Connection.Create(nil);   CallDB.Hostname := 'localhost';   CallDB.DatabaseName := '/home/ian/voip recording 2/voip';   if(NOT CallDB.Connected) then      CallDB.Open;    Database name is the absolute path, however I have tried just "voip" which is relative to where the program is. Program simply stops running after open is hit. Any ideas? ---------------------------------------------------------------------- iwilson · 2011-11-18 13:12 No one? Using TSQLite3Connection as a form control works fine for me but in my guiless program I can't seem to get what I posted above to work, what am I missing? ---------------------------------------------------------------------- Leledumbo · 2011-11-18 14:04 If you could do it via form designer, you can try doing that first and checkout the properties' value in object inspector. There might be missing but required values. ---------------------------------------------------------------------- ludob · 2011-11-18 14:08 QuoteNo one? Using TSQLite3Connection as a form control works fine for me but in my guiless program I can't seem to get what I posted above to work, what am I missing?The code you posted doesn't do anything. It opens the database and then? The console program Code: [Select]begin CallDB := TSQLite3Connection.Create(nil);   CallDB.Hostname := 'localhost';   CallDB.DatabaseName := '/home/ian/voip recording 2/voip';   if(NOT CallDB.Connected) then      CallDB.Open;  end. will do nothing unless there is an error opening the database. Then it will print the exception. Post a sample program that doesn't work and explain what you expected to happen. ---------------------------------------------------------------------- iwilson · 2011-11-18 14:27 It doesn't end there... I have two sockets running, one listening on TCP and one recording VOIP calls over UDP. These work fine with the above code commented out, with the code in the program simply stops doing anything after Open, however there is no crash or error and Lazarus remains in "debugging" state. The properties match up exactly the same in the form program. ---------------------------------------------------------------------- iwilson · 2011-11-18 14:36 I should add that this has been tried across multiple PCs now, Ubuntu and Debian, all PCs that currently run GUI Lazarus SQLite programs. I think I may have to write this off as a Lazarus bug unless I'm missing something silly here. ---------------------------------------------------------------------- Martin_fr · 2011-11-18 14:53 Just a guess, I haven't tried anything myself, so I might be entirely wrong: You say it works in GUI It also sounds as if you are talking about a console program? (not an application) What if the component needs the message loop of an application? ---------------------------------------------------------------------- BigChimp · 2011-11-18 15:06 iwilson, you might want to post a simple console app with that code as well as the sqlite database. Then others can test it and see if there's an error in there... ---------------------------------------------------------------------- ludob · 2011-11-18 15:06 QuoteLazarus remains in "debugging" stateWhere does the program stop when you click pause? QuoteI think I may have to write this off as a Lazarus bug unless I'm missing something silly here. I don't get this. It works with GUI but it fails without GUI. What has lazarus to do with this? Is the problem only occurring inside lazarus? Then check if you have the unit pthreads as the first uses in your main unit else the debugger will complain about threads and sqlite uses threads. Is your program, in lazarus terms, a program, a console application or ...? Your code snippet works correctly in a console program, inside (with pthreads) and outside lazarus. When the database file doesn't exist the file will be created (empty database obviously). So, the problem is linked to something you haven't told us. ---------------------------------------------------------------------- iwilson · 2011-11-18 15:13 I'm all for sharing code however this is a work project and I don't think I can. However I'm convinced the rest of my code isn't related (other than possibly uses) so I created a new console application and slapped in the few lines as seen here: Code: [Select]program project1; {$mode objfpc}{$H+} uses   {$IFDEF UNIX}{$IFDEF UseCThreads}   cthreads,   {$ENDIF}{$ENDIF}   Classes, SysUtils, CustApp, sqlite3conn, sqldb;   { you can add units after this } type   { TMyApplication }   TMyApplication = class(TCustomApplication)   protected     procedure DoRun; override;   public     testDB : TSQLite3Connection;     constructor Create(TheOwner: TComponent); override;     destructor Destroy; override;     procedure WriteHelp; virtual;   end; { TMyApplication } procedure TMyApplication.DoRun; var   ErrorMsg: String; begin   // quick check parameters   ErrorMsg:=CheckOptions('h','help');   if ErrorMsg<>'' then begin     ShowException(Exception.Create(ErrorMsg));     Terminate;     Exit;   end;   // parse parameters   if HasOption('h','help') then begin     WriteHelp;     Terminate;     Exit;   end;   testDB := TSQLite3Connection.Create(nil);   testDB.Hostname := 'localhost';   testDB.DatabaseName := '/home/ian/voip recording 2/voip';   testDB.Open;   while(true) do begin     Writeln('HELLO');     Sleep(5000);   end;   { add your program here }   // stop program loop   Terminate; end; constructor TMyApplication.Create(TheOwner: TComponent); begin   inherited Create(TheOwner);   StopOnException:=True; end; destructor TMyApplication.Destroy; begin   inherited Destroy; end; procedure TMyApplication.WriteHelp; begin   { add your help code here }   writeln('Usage: ',ExeName,' -h'); end; var   Application: TMyApplication; {$IFDEF WINDOWS}{$R project1.rc}{$ENDIF} begin   Application:=TMyApplication.Create(nil);   Application.Title:='My Application';   Application.Run;   Application.Free; end. With the SQL lines commented out I'll sit within the while loop no problem, however without them commented I simply drop off after "Open". Thanks guys. ---------------------------------------------------------------------- iwilson · 2011-11-18 15:18 I missed some further details, when stepping through the last line it will hit is Open. Once executing that it simply runs no further. There are full permissions to the database. My original program is simply just a program however as you can see I've now tried it in console as well. ---------------------------------------------------------------------- ludob · 2011-11-18 15:38 You're sample program runs fine in lazarus when adding pthreads as the first unit in the uses clause (and changing the path to the db). Outside lazarus, from the console, the program runs also without pthreads. ---------------------------------------------------------------------- iwilson · 2011-11-18 15:58 That wouldn't work on my Ubuntu machine with that same console app I just posted, however I went over to my Debian machine that my program is on and added pthreads to my program and it now works fine. Thanks A LOT, that was extremely frustrating ---------------------------------------------------------------------- ludob · 2011-11-18 16:11 QuoteThat wouldn't work on my Ubuntu machine with that same console app I just postedThen you probably need to upgrade gdb. I tested on ubuntu x64 with gdb 7.1.