Get Blob from Firebird SQL Database

2 ビュー (過去 30 日間)
Rene Bilsing
Rene Bilsing 2019 年 2 月 11 日
回答済み: Rene Bilsing 2019 年 2 月 11 日
Hi all,
I'm trying to read a blob with help of a JDBC driver out of a Firebird SQL database. The normal SQL query are working as expected but as soon as I want to read blob, I get this kind of result: org.firebirdsql.jdbc.FBBlob@24027b42. The value after the "@" sign is changing after each try. I'm tried both, accessing the blob with help of the database explorer of the database toolbox and with a script. The result is very similar.
For me it looks like that the result is referring to any kind of address but I don't know how to access the data.
Any kind of help is appreciated. Thanks in advance.
  4 件のコメント
Guillaume
Guillaume 2019 年 2 月 11 日
編集済み: Guillaume 2019 年 2 月 11 日
Ok then, what is the class of the content of that cell?
class(rsdata{1})
Rene Bilsing
Rene Bilsing 2019 年 2 月 11 日
class(rsdata{1})
ans =
org.firebirdsql.jdbc.FBBlob

サインインしてコメントする。

採用された回答

Guillaume
Guillaume 2019 年 2 月 11 日
So, what you're getting back is a java object of type org.firebirdsql.jdbc.FBBlob. You can use the methods of that object to get information about the blob and access the actual data. Most likely:
blobdata = rsdata{1}.getBytes(1, 0); %Get from 1st byte of length 0
I'm assuming that length 0 means everything, if not:
blobdata = rsdata{1}.getBytes(1, rsdata{1}.length()); %length is the length of the blob

その他の回答 (1 件)

Rene Bilsing
Rene Bilsing 2019 年 2 月 11 日
Exactly what I was looking for. Thanks!

カテゴリ

Help Center および File ExchangeDatabase Toolbox についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by