0

I need to deserialize() a Java object stored in a BLOB. Database instance has no server-side Java loaded, and never gets one. I can't connect to the database with a Java code, only with SQL client such as TOAD. So the only option seems to be, implement deserialization in PL/SQL. Any ideas, how?

10
  • You don't have a JDBC driver to connect to the database from your application? If not how would you provide the data to deserialize to any PL/SQL and how would you trigger? - What you might try in this case: deserialize to a file and load that file into a blob manually. Commented Dec 15, 2015 at 10:19
  • Possible duplicate of deserialize java object from a blob Commented Dec 15, 2015 at 10:22
  • @Thomas, no I can't connect from any external / unapproved app including Java including JDBC Driver, it's about security and it's strict. Serialized Java Object is stored in a BLOB by another (approved) app. Commented Dec 15, 2015 at 10:23
  • @Kraal, it's no duplicate because I can't use Java, neither server- nor client-side. Commented Dec 15, 2015 at 10:24
  • If you can't use Java anywhere, why would you have a serialized Java object in the database? Commented Dec 15, 2015 at 10:28

1 Answer 1

0

I don't know what you're trying to achieve, but if there is no way to ask your "approved java app" to write the data you need in a readable form (is the data stored by a 3d party application you bought ? If so, can't they provide you with a tool to achieve what you want ?) , and if you can't write your own java program to read these serialized object, I guess that the only way to do what you're trying to achieve is:

  1. Read the Java Object Serialization specification located at https://docs.oracle.com/javase/8/docs/platform/serialization/spec/serialTOC.html (for JDK 8)
  2. Make sure you know the class you want to analyse (if objects are an instance of different classes this may help you filter the objects you're looking for)
  3. Deserialize in PL/SQL the objects by following the serialization stream format and read the fields you're looking for.

This article can help you understand the serialization algorithm : http://www.javaworld.com/article/2072752/the-java-serialization-algorithm-revealed.html

Note: I do not recommend this approach, you should rather find a way to store the data in a readable format.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your effort. App and its data is legacy, I have no control over it. Do you know of any existing implementation of Java Object Serialization specification in PL/SQL?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.