[Solved] Connect from Qt

Discuss the database features
Post Reply
oowilliam
Posts: 2
Joined: Mon Apr 17, 2023 6:53 pm

[Solved] Connect from Qt

Post by oowilliam »

I can't find an answer on the Qt forums. I hope someone here can help. I do I establish a connection from Qt to a LibreOffice Base database on the same Linux box where I'm running Qt Creator. I have tried

QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName("/home/bill/Macro/Addresses.odb");

with various settings for password and user (the database requires neither) but nothing works. Thanks.
Last edited by MrProgrammer on Sun Jun 25, 2023 3:39 pm, edited 1 time in total.
Reason: Tagged ✓ [Solved] -- MrProgrammer, forum moderator
LibreOffice 7.3.7.2 on Linux Mint 21 Cinnamon 5.4.12
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Connect from Qt

Post by Villeroy »

Base is not a database. Base is a client tool to work with databases in the context of the office suite. Base provides database access to office documents but not to the outside world. When you open your "/home/bill/Macro/Addresses.odb", the status bar indicates the actual database. It may be embedded in the odb, it may be a spreadsheet, a directory of text files, some connection to a true database (MySQL, PostgreSQL, SQLite, Firebird, dBase, Oracle, ...). That would be the the source you may be able to connect via QODBC.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
oowilliam
Posts: 2
Joined: Mon Apr 17, 2023 6:53 pm

Re: Connect from Qt

Post by oowilliam »

Thanks so much, Villeroy. This answers a number of issues I was having.
LibreOffice 7.3.7.2 on Linux Mint 21 Cinnamon 5.4.12
Post Reply