MS Access via ODBC on Debian Linux 64 lazarus / 16-Databases ---------------------------------------------------------------------- linuxfan · 2024-01-24 07:29 Hi all, I've written a program on winslow; the program uses an Access database; I'm trying to run it in linux (Debian stable, 64 bit). I installed MDBTools and configured the DSN. The isql(1) command works. When I configure the ODBConnection on my form, and click "Connected", Lazarus says Quote  Can not load ODBC client. Is it installed? (libodbc.so) I have installed libodbc.so.1 and libodbc.so.2; I've read that programs should not try to load unversioned shared objects. Anyway, I symlinked libodbc.so to libodbc.so.2, and now the ODBCconnection works (it does get Connected). Next step is to activate the SQLQuery. I set UsePrimaryKeyAsKey to false, and try to edit ("...") the SQL property: executing the query (a simple "select * from ..."), the following error is shown: Quote  Could not retrieve primary key metadata for table Item using SQLPrimaryKeys. ODBC error details: LastReturnCode: SQL_ERROR; Record 1: SqlState: IM001; NativeError: 0; Message: [unixODBC][Driver Manager]Driver does not support this function; If I look at the FieldDefs property, all the fields of the table show up correctly, so it seems something is working. For completeness I can use LibreOffice Base to open the database, no errors arise, but no table is visible. What else can I try? ---------------------------------------------------------------------- mig-31 · 2024-01-24 10:27 Hi, by this https://wiki.freepascal.org/MS_Access you need mdbtools. ---------------------------------------------------------------------- Zvoni · 2024-01-24 11:11 Quote from: mig-31 on January 24, 2024, 11:27:32 amHi, by this https://wiki.freepascal.org/MS_Access you need mdbtools. It helps if you read the first post completely, instead of just the Subject line QuoteI installed MDBTools and configured the DSN. The isql(1) command works. ---------------------------------------------------------------------- TRon · 2024-01-24 14:00 Quote from: linuxfan on January 24, 2024, 08:29:32 amI installed MDBTools and configured the DSN. The isql(1) command works. When I configure the ODBConnection on my form, and click "Connected", Lazarus says Quote  Can not load ODBC client. Is it installed? (libodbc.so) I have installed libodbc.so.1 and libodbc.so.2; I've read that programs should not try to load unversioned shared objects. Anyway, I symlinked libodbc.so to libodbc.so.2, and now the ODBCconnection works (it does get Connected). You should never have the need to symlink those libraries manually. I did not manage to find the library dev packages on my system (debian), but was able to stumble upon mdbtools-dev so you might want to try that instead of a manual symlink. Alternatively the mdbtools github page mentions package unixodbc-dev ---------------------------------------------------------------------- linuxfan · 2024-01-24 16:11 Hi TRon, I don't understand what you say about "did not manage to find" and "stumble upon". Are you suggesting that installing the "-dev" package could solve my issue? I didn't do so because I am not interested in the "-dev" packages. But, on the other hand, I actually AM developing... but not ODBC itself. ---------------------------------------------------------------------- TRon · 2024-01-24 17:14 Quote from: linuxfan on January 24, 2024, 05:11:47 pmI don't understand what you say about "did not manage to find" and "stumble upon". I mean that in my used Debian distribution there are no libodbcX-dev packages listed in the package manager. QuoteAre you suggesting that installing the "-dev" package could solve my issue? I didn't do so because I am not interested in the "-dev" packages. But, on the other hand, I actually AM developing... but not ODBC itself. Depending on your Linux distribution (which base Linux it is using) you are required to install the xx-dev package in order to solve library versioning numbering issues that might arise. A dev package will (should) automatically create the missing link using the correct (accepted) library name linking it to the correct library version that the system is configured/setup to use. That is what distribution/package maintainers do. Depending on the package the xxx- dev package might setup/configure other system related settings that allows you to work (as a developer) with a specific library. It is a basic Linux (again depending on the distribution) concept f.e. see https://stackoverflow.com/questions/1157192/what-do-the-dev- packages-in-the-linux-package-repositories-actually-contain ---------------------------------------------------------------------- linuxfan · 2024-01-25 05:49 I removed the handmade link and installed mdbtools-dev. But that didn't create the link. So I removed that and installed unixodbc-dev. That created the symlink, but under Lazarus nothing is changed, same error. Apart from that, I noticed that libodbc.so.1 is merely a symlink to libodbc.so.2. So, it seems, no "versioning" would be needed. Just for completeness. I will search more, thanks anyway. ---------------------------------------------------------------------- TRon · 2024-01-25 06:28 Quote from: linuxfan on January 25, 2024, 06:49:55 amThat created the symlink, but under Lazarus nothing is changed, same error. Thank you for reporting back linuxfan. Sorry, I did not have a look at your actual error yet till now. Perhaps this can be of help ? edit: I also found this thread which mentions the exact same error message (on/for Windows  ). ---------------------------------------------------------------------- Jiyahana · 2024-01-25 11:48 Check correct ODBC driver installation, use a compatible version of libodbc and address SQLPrimaryKey error by adjusting database setting or switching to a different driver.