0

So, I'm in way over my head here and been trying this for 8 hours and have gotten zilch

Some context:

I'm looking into a issue for a friend where I need to convert some data from a homebrew database made in LibreOffice Base backed by some Firebird implementation (I'm a 100% new to this so I'm not sure how this is called/works) I need to convert this data to a xml which has to confirm to some xsd supplied by some third party company.

I've already generated code from the xsds (50K lines of code......) and should be able to map the data in C#, poop out an xml and they are good to go.

However, I'm having trouble accesing the data from the database file.... I have googled for I don't know how long, but I can't seem to find how to do this in .net.

I can unpack the .odb file and check the contents. It's only some xml's which define some queries, tables and forms. And 1 .fbk file. I'm actually not sure where the data is apart from the fbk file, but googling only tells me that's apparently a back-up file used for restoring, I'm guessing it's holding the actual data, but then?

There is not a lot of data in the file, it should be easy to load into memory so I don't expect any problems there. (they also use a new db for every project, so a few MB's tops every time the xml conversion is needed)

Does anyone know if this is even possible? And how do I achieve this?

DaVaMa
  • 11
  • 5
  • The following may be helpful: https://fileinfo.com/extension/odb and https://www.codeproject.com/Articles/38425/How-to-Read-and-Write-ODF-ODS-Files-OpenDocument-2 – Tu deschizi eu inchid Apr 04 '21 at 20:25
  • Thanks, but I think I've already read a hundred variations of that info. The .odp file is not the problem per sé, its where the data is stored. As I can't make any headway with the actual database, which is a .fbk file. – DaVaMa Apr 04 '21 at 20:30

1 Answers1

0

Are you trying to connect to the database to run queries with C#? This can be done with the LibreOffice SDK. There is a C# example for Calc included in the SDK distribution: https://api.libreoffice.org/examples/examples.html#CLI_examples.

Once you are able to get C# and LO to work together, look for Base examples online and adapt them into C#, such as:

There is quite a bit of similar information out there, although it is not well organized so expect to spend some time searching. If you are willing to work in other languages, Java is much better than C# for working with the LO SDK.

Here's another, completely untested idea. You mentioned the .fbk file found when unzipping the .odb Base file. That is a Firebird backup file. So, it seems like this should work:

  1. Install the correct version of Firebird. To verify the embedded engine version, in LO Base go to Tools -> SQL and run the query from Ways to Determine the Version of Firebird SQL? This produces 3.0.0 in LO 7.1, the same version as LO 5.3.
  2. Run gbak to restore the .fbk file.
  3. Connect to Firebird from C# using a connection such as ODBC.
Jim K
  • 12,824
  • 2
  • 22
  • 51
  • Thanks for the answer! I'm going to try to connect with the SDK, I'm not sure how I missed it while searching. I'm going to give it a try in C# and if that doesn't work I'll try Java. I actually tried restoring the fbk in firebird, using some gui tool I found online but I could not get it to work, I'm probably missing something there but I might have to revisit that if the other things don't work. – DaVaMa Apr 05 '21 at 16:59