简体   繁体   中英

Best datatype to store a java object to Oracle database

I want to save a java object (say a Person object) into a column in a table in Oracle 12c database. What is the best datatype suitable for this?

You can store complex objects in Oracle in an XMLType or JSON format.

However it is probably the wrong tool for that job. If you are going to always access an object via a key, go for a dedicated Key-Value database product rather than an RDBMS. If you need to access objects via attributes, such as the person's name, then having that attribute buried in an object will be painful.

If the requirement is a single field in an Oracle database table, I'd suggest a CLOB (assuming it's only ascii and no binary data). When storing binary data, use a BLOB. BLOB= Binary Large OBject CLOB = Character Large OBject.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM