使用 .NET 读取存储在数据库中的 Java BLOB 对象
我有一个 xml 文件,它存储在 MSSQL 数据库的“图像”列中。该字段是由我无权访问的 java 程序设置的。有人告诉我它只是一个标准的 Java“blob”对象。
无论如何,我是否可以从 .NET 中的数据库中读取该字段并将其解码为可读字符串?
我几乎没有任何 Java 知识,但拥有丰富的 .NET 知识(如果有帮助的话)。
谢谢
I have an xml file which is stored in an "image" column in an MSSQL database. This field is being set by a java program i do not have access to. I have been told its just a standard Java "blob" object.
Is there anyway for me to read this field from the db in .NET and decode it into a readable string?
I have close to no Java knowledge but signigicant .NET knowledge if that helps.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里似乎有一个将 blob 读取为字节的可行示例:
https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-5766889.html
到目前为止作为“标准 Java“blob”对象”,这听起来像是一个神话般的野兽,除非他指的是序列化为 blob 字段的 Java 对象。您可能可以查看 Java 序列化规范并找出答案,但与此同时,在我看来,标准 glib 管理器给您提供了一个标准 Java 对象任务。
想想看,这是一个非常巧妙的建议。请参阅该同事关于将 Java 对象反序列化为 .NET 的评论:
以不同语言反序列化
There seems to be a workable example for reading the blob as bytes here:
https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-5766889.html
As far as a "standard Java "blob" object", that sounds like a mythical beast, unless he means a Java object serialized into a blob field. You could probably look into the spec for Java serialization and figure it out, but meantime it sounds to me like you've been given a standard Java object task by a standard glib manager.
Come to think of it here's a pretty neat suggestion. See the comment by the fellow regarding deserializing Java objects into .NET:
Deserialize in a different language
它应该只是一个
byte[]
。你尝试过这样阅读吗?It should just be a
byte[]
. Have you tried reading it as such?