B4J Question Select BLOB via jRDC2 - MariaDB

vfafou

Well-Known Member
Licensed User
Longtime User
Hello!
I have a table in MariaDB with a BLOB column to store documents and images.
The INSERT command works perfectly but when I try to SELECT the table rows, I take the following error:
B4X:
java.lang.RuntimeException: java.io.EOFException
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readType(B4XSerializator.java:314)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:374)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.ReadObject(B4XSerializator.java:129)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.ConvertBytesToObject(B4XSerializator.java:99)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator$2.call(B4XSerializator.java:110)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator$2.call(B4XSerializator.java:1)
    at anywheresoftware.b4a.BA$4.run(BA.java:292)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
    at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.io.EOFException
    at java.base/java.io.DataInputStream.readByte(DataInputStream.java:271)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readByte(B4XSerializator.java:150)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:318)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readList(B4XSerializator.java:263)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:371)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readList(B4XSerializator.java:263)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:362)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readMap(B4XSerializator.java:248)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readType(B4XSerializator.java:292)
    ... 11 more
Error reading response: (EOFException) java.io.EOFException
I've read many related threads here in community but nothing works.
The data type I use for BLOB is LONGBLOB. I changed it to MEDIUMBLOB but the problem still persists!
I tried to exclude the BLOB column from my SELECT statement but the problem is still here!
Note that the BLOB data stored in database is valid, because I can save the data as image, via MariaDB procedures.
All table IDs are INT datatype and not BIGINT.

UPDATE:
The error occurs even if I remove the BLOB column! And this table is the only one in my application that causes a problem when retrieving data!
The structure of my table is an ordinary table structure as:
B4X:
CREATE TABLE `m_files` (
    `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `descr` VARCHAR(255) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci',
    `origin_path` VARCHAR(500) NOT NULL DEFAULT '' COLLATE 'utf8mb4_general_ci',
    `doc_type` VARCHAR(5) NOT NULL DEFAULT '' COLLATE 'utf8mb4_general_ci',
    `doc_data` LONGBLOB NOT NULL,
    `insert_date` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    `update_user` VARCHAR(30) NOT NULL DEFAULT 'AUTO' COLLATE 'utf8mb4_general_ci',
    `update_date` TIMESTAMP,
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `origin_path_idx` (`origin_path`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=Aria
AUTO_INCREMENT=1
;
 
Last edited:

vfafou

Well-Known Member
Licensed User
Longtime User
Add Log(ct & ": " & GetType(row(i))) at line 88, before the Next statement.

Post the output.
Hello Erel!
Thank you for your response!
This is the output:
B4X:
4: java.lang.Long
4: java.lang.Long
4: java.lang.Long
12: java.lang.String
12: java.lang.String
12: java.lang.String
-4: [B
-5: java.math.BigInteger
12: java.lang.String
93: java.lang.Long
4: java.lang.Long
4: java.lang.Long
4: java.lang.Long
12: java.lang.String
12: java.lang.String
12: java.lang.String
-4: [B
-5: java.math.BigInteger
12: java.lang.String
93: java.lang.Long
4: java.lang.Long
4: java.lang.Long
4: java.lang.Long
12: java.lang.String
12: java.lang.String
12: java.lang.String
-4: [B
-5: java.math.BigInteger
12: java.lang.String
93: java.lang.Long
Command: query: select_visitfiles, took: 663ms, client=127.0.0.1
java.lang.RuntimeException: java.io.EOFException
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readType(B4XSerializator.java:314)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:374)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.ReadObject(B4XSerializator.java:129)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.ConvertBytesToObject(B4XSerializator.java:99)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator$2.call(B4XSerializator.java:110)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator$2.call(B4XSerializator.java:1)
    at anywheresoftware.b4a.BA$4.run(BA.java:292)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
    at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.io.EOFException
    at java.base/java.io.DataInputStream.readByte(DataInputStream.java:271)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readByte(B4XSerializator.java:150)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:318)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readList(B4XSerializator.java:263)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:371)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readList(B4XSerializator.java:263)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:371)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readList(B4XSerializator.java:263)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:371)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readList(B4XSerializator.java:263)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:362)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readMap(B4XSerializator.java:248)
    at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readType(B4XSerializator.java:292)
    ... 11 more
Error reading response: (EOFException) java.io.EOFException
 
Upvote 0
Top