Question

I m trying to load json data into in memory database h2.

when i create datasource i have to set url where i m not getting to how to define path for json data file.

Need guidence.

Was it helpful?

Solution

I would use a JSON parser to read and parse the JSON, and then use the JDBC API to insert the data into the database.

With the JDBC API, make sure you use PreparedStatement, that means, create one PreparedStatement per table, and re-use those. What you could do is keep them in a map, one prepared statement per table (Map<String, PreparedStatement>).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top