Recommendation for a Java in memory database
Looking for a recommendation. I have a command line utility that now needs to process a large amount of data coming from a web service in a form of a CSV.
I need to run multiple tests on the data to look for anomalies and patterns. I'd like the utility to be something that someone can download and not have to install or configure.
Is there a recommendation for a NoSQL or SQL database that I can just spin up in memory, load the CSV into a table and then run my queries against that data?
Can Redis be used without installation? Something else?
How about H2 Database? It's pure Java, in-memory and can be embedded into your application, see Connecting to an Embedded (Local) Database
import org.h2.jdbcx.JdbcDataSource; JdbcDataSource ds = new JdbcDataSource(); ds.setURL("jdbc:h2:˜/test.db"); ds.setUser("sa"); ds.setPassword("sa"); Connection conn = ds.getConnection();
If you want an in-memory database, change URL to something like jdbc:h2:mem:test.db or similar. Look for "in-memory Databases" in documentation.
I have not yet used it, but have a look at JasDB
From the website.
Quick Install guide
JasDB is incredibly easy to get started with it is up and running under a minute simply download and run it, or simply include it in your project Instructions
- Install JasDB by unzipping the download
- Start the database using start.bat or start.sh
- Open http://localhost:7050
JasDB can run with full in memory based indexes and record storage. The following configuration needs to be used in that case:
<Storage> <RecordWriter provider="inmemory"/> <!--<RecordWriter provider="transactional"/>--> </Storage>