MySQL BLOBs and Base (Solved)

I’m on Debian 10, using LO 7.1 and MariaDB 10.5.8-MariaDB-1:10.5.8+maria~buster. I connect Base directly via a socket.

I have created a table and a form based on the table:

MariaDB [greenhouse]> desc plant;
+---------+--------------+------+-----+---------+-------+
| Field   | Type         | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| id      | int(11)      | NO   | PRI | NULL    |       |
| genus   | varchar(128) | YES  | MUL | NULL    |       |
| species | varchar(128) | YES  |     | NULL    |       |
| picture | blob         | YES  |     | NULL    |       |
+---------+--------------+------+-----+---------+-------+
4 rows in set (0.210 sec)

Just like this question, when I upload an image, it disappears as soon as I save it. I have read the answer and followed the links, but I don’t think they answer the wuestion or suggest a way to troubleshoot the issue.

I know from working with Java EE, that it is perfectly possible to store and retrieve images in MySQL/MariaDB, so the problem isn’t the database. Is there anything one needs to do, other than naively following the wizard?

Hello,

Possibly your method of connection. On this post → Mysql ODBC and XROW an ODBC connection did not work with images yet JDBC seemed OK.

Same question posted on the OpenOffice forum

Adding this as an answer, so others can benefit:

Inspired by Ratslinger’s comment, I changed from connecting through a socket to JDBC, which made it fail with an error message:

Error updating the current record /home/buildslave/source/libo-core/connectivity/source/commontools/dbtools.cxx:751

Data truncation: Data too long for column 'picture' at row 1 /home/buildslave/source/libo-core/connectivity/source/drivers/jdbc/Object.cxx:175

However, that is a good thing - it shows that it is actually trying to store that column. My image is 130KB and a BLOB in MySQL only allows up to 64KB. After changing to a LONGBLOB, it works.

Now, why a direct connection, which one would assume uses the MySQL API, can’t handle a BLOB, is another question, but this now works.