How to save map objects in Java to MySQL database
•
Java
I have Java map (string and ints) objects and I want to save them to the database
Solution
You actually asked two different questions:
>How to save map objects to a database
You need to create a database and an appropriate table You can serialize a map as a binary object and store it in the database as a blob However, it is better to create a table entry for each object in the map You need to use the JDBC API to communicate with the database
>How to compress the gross to take up less space in the hard disk?
You need to map the serialize map to a file The map will be saved in a binary file, and you can try using compress
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码