How to save Map objects in Java database in MySQL

I have a Java Map (from string and ints) objects that I want to save in a database. Is there a standard way to solve this problem? Is there a way to compress the card to make less hard disk space?

+3
source share
1 answer

You are actually asking two different questions:

  • How to save a Map object in a database

You need to create a database and a corresponding table. You can serialize the map into a binary object in the original way and save it in the database as a BLOB. However, it would be better to have a table entry for each feature on the map. To communicate with the database you need to use the JDBC API .

  • How to compress Mao to make less hard disk space?

You need to serialize the map to a file. The map will be saved in a binary file that you can try compress .

+7
source

Source: https://habr.com/ru/post/1740746/


All Articles