Reputation: 79
I've heard of the H2 database, but how does it work? I'm now scraping data from many websites and don't want to visit the same URL that I've already scraped. Is it possible for me to use the H2 database in that case?
Upvotes: 7
Views: 9291
Reputation: 2947
H2 is an open source Java SQL Database. It can be run in both embedded and server mode. It is widely used as an In-memory database.
In-memory database relies on system memory as oppose to disk space for storage of data. Because memory access is faster than disk access. We use the in-memory database when we do not need to persist the data. The in-memory databases are volatile, by default, and all stored data loss when we restart the application.
If you want to persist the data in the H2 database, you should store the data in a file. To achieve the same, you need to change the datasource URL property in your application properties file.
Learn more about H2 here
Upvotes: 6