Recent

Author Topic: Assigning firebird file name to TIBConnection  (Read 502 times)

egsuh

  • Hero Member
  • *****
  • Posts: 1738
Assigning firebird file name to TIBConnection
« on: January 19, 2026, 08:29:32 am »
Hello,

I'm using MS OneDrive. So, the full path on my local PC is like d:\OneDrive\MyLazarus\DataBase\DB.FDB.

If I assign this full path to the DatabaseName property of TIBConnection, then there are no problem in setting this DB connected.

But if I try to define relative path, like .\DataBase\DB.FDB, then it shows DoInternalConnect error, with "error while trying to open file".

The same approach works on another PC, which shares OneDrive but local location is different - not on d:, but o c: somewhere, without problem.

What could be the cause of the error? 

Zvoni

  • Hero Member
  • *****
  • Posts: 3270
Re: Assigning firebird file name to TIBConnection
« Reply #1 on: January 19, 2026, 08:47:27 am »
Are you running from IDE, or from the Exe?

Take a look at ParamStr(0) or Application.Location
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

egsuh

  • Hero Member
  • *****
  • Posts: 1738
Re: Assigning firebird file name to TIBConnection
« Reply #2 on: January 19, 2026, 09:27:26 am »
Quote
Are you running from IDE, or from the Exe?

I'm connecting within IDE. But it does not work at runtime either.

Quote
Take a look at ParamStr(0) or Application.Location

How can I check them?

Zvoni

  • Hero Member
  • *****
  • Posts: 3270
Re: Assigning firebird file name to TIBConnection
« Reply #3 on: January 19, 2026, 09:41:24 am »
Quote
Take a look at ParamStr(0) or Application.Location

How can I check them?
Place a TLabel on your Form, and assign ParamStr(0) or Application.Location in Form.OnShow.
Another Option might be to Write to a txt-File inside the lpr-file before the Form loads
It's "old school"-Debugging.

Just thought of something else, since you mention OneDrive:
I remember falling afoul of a OneDrive-location, since OneDrive actually uses Forward-Slashes as DirectorySeparator if you don't use absolute local path.

That said: Try
./DataBase/DB.FDB
as relative path

On a sidenote: OneDrive has given me blinding headaches in the past.
In a nutshell: During development i read the Registry under
Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\OneDrive\Accounts\{Profile}
with "{Profile}" being whatever Account you use (Business, Personal, whatever), and INSIDE there it's the Key "UserFolder" which gives you the local path.
Construct full LOCAL path from there (With Backslash as Separator)
« Last Edit: January 19, 2026, 09:56:14 am by Zvoni »
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

egsuh

  • Hero Member
  • *****
  • Posts: 1738
Re: Assigning firebird file name to TIBConnection
« Reply #4 on: January 19, 2026, 09:56:40 am »
Quote
./DataBase/DB.FDB

No, this does not work.
What I really access is a local file copied to my local HDD.

Zvoni

  • Hero Member
  • *****
  • Posts: 3270
Re: Assigning firebird file name to TIBConnection
« Reply #5 on: January 19, 2026, 10:00:19 am »
Quote
./DataBase/DB.FDB

No, this does not work.
What I really access is a local file copied to my local HDD.
Last option: What's the Value for UserFolder in the Registry (see Edit above)?
The only thing i can think of, is that your "real" OneDrive-Folder is pointing to somewhere else
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
Re: Assigning firebird file name to TIBConnection
« Reply #6 on: January 19, 2026, 10:02:09 am »
That's how OneDrive works: with time-based sync, not with real-time sync.
You have to use another solution for that. OneDrive paths are essentially local paths with a back-up service in the background. That is completely different from a fully networked drive.
But the local "copy" is the main file, so you can safely work on it and it will persist *as long as nobody else has write access to your OneDrive *

A commercial solution is here, but that maps actually an intermediate cloud drive:
https://www.konnekt.io/?msclkid=8eb5f4bc52b9133c19279dd1a153c0c0&utm_source=bing&utm_medium=cpc&utm_campaign=Product+|+KONNEKT+|+Klicks&utm_term=onedrive+network+drive+mapping&utm_content=KONNEKT+|+KO-U1

There are some options on the web but none of the free options are reliable.
« Last Edit: January 19, 2026, 10:52:46 am by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

egsuh

  • Hero Member
  • *****
  • Posts: 1738
Re: Assigning firebird file name to TIBConnection
« Reply #7 on: January 19, 2026, 10:18:22 am »
With full path, I can use the db file. The problem is local location of OneDrive is different between two computers.

On my notebook, it is located at "c:\users\seg\..." something,  and on my desktop it is located as "d:\OneDrive".
My lazarus project files have no problem as they all are defined with relative path.
And I think I would be able to define DB file in relative path as well, which simply does not work.

Anyway I have to find another way --- because as the files are used by FCGI webservers on both machines (which means both DB files are open once I call the FCGI server), they are not synchronized with cloud server (web OneDrive).

 

TinyPortal © 2005-2018