Firebird embedded dynamic connect. lazarus / 16-Databases ---------------------------------------------------------------------- markhorrocks · 2012-04-12 03:15 I am trying to set SQLQuery1.DatabaseName := ExtractFilePath(ParamString(0) + 'mydb.fdb' in the form create or show events and I get an file open error that its still looking for the design time file. How can I set a db path name based on the current install path dynamically. This works fine if I leave the path set in design time. Problem with that is that I don't know whether program files will be (x64) or not. This works fine in Delphi using Firebird server but i want to use embedded. ---------------------------------------------------------------------- goldenfox · 2012-04-12 05:08 Maybe set it like this? Code: [Select]SQLQuery1.Database := IBConnection1; IBConnection1.Databasename := /path/to/mydb.fdb ---------------------------------------------------------------------- markhorrocks · 2012-04-12 07:06 Quote from: goldenfox on April 12, 2012, 07:08:06 amMaybe set it like this? Code: [Select]SQLQuery1.Database := IBConnection1; IBConnection1.Databasename := /path/to/mydb.fdb Now I see that it has nothing to do with setting the DatabaseName in code. Now, I get the same error at runtime even when i leave it set at design time where it can connect. ---------------------------------------------------------------------- BigChimp · 2012-04-12 08:07 Strange. Storing your database in program files is not a smart move, security wise (unless it's a read only db, I suppose). See the wiki articles on cross platform programming and windows for some ideas on where to store data files. You might be having permission problems (access denied) - but then it's strange it works at design time and not at run time. Edit: oh, if it works at design time, not at run time: please make sure the firebird embedded dlls are present in the application directory (or windows\system32 directory, I suppose, but I wouldn't go that route). Hint: posting your Lazarus version, platform (obviously some form of Windows) and actual code is not a bad idea when posting... ---------------------------------------------------------------------- markhorrocks · 2012-04-12 11:05 I think I have this figured out. The sigsegvs seem to be due to having a separate IBconnection component in each form. When I refactored that to having a single IBconnection in the main form the issue seemed to be resolved. In Delphi I used a single database in a separate RDM app. The connection errors were a problem to me because I had the server running at the same time as trying to make the app work with embedded. I gave up embedded and stuck to the server and everything seems ok now. ---------------------------------------------------------------------- markhorrocks · 2012-04-12 11:12 Quote from: BigChimp on April 12, 2012, 10:07:33 amStoring your database in program files is not a smart move, security wise (unless it's a read only db, I suppose). See the wiki articles on cross platform programming and windows for some ideas on where to store data files.My first bright ideas was just to install the lot in c:\myapp but whatever antivurus or something installed on the clients computer complained that myapp might be malware. I guess because it wants to install into the root directory. Quote from: BigChimp on April 12, 2012, 10:07:33 amHint: posting your Lazarus version, platform (obviously some form of Windows) and actual code is not a bad idea when posting... I was getting round to making up a demo but then the eureka moment hit me. Its windows running in a vbox vm. I normally operate in ubuntu. This is the only GUI app I'll probably ever do :-) ---------------------------------------------------------------------- markhorrocks · 2012-04-13 15:10 I still can't get this to work. No matter where I try to set my database name in code, I still get an error saying it can't find the design time path.