• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

How to populate h2 memory table with a Real Database Table?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi community!
I hope i can explain this in a proper way.

I have a Sql Server Database with serveral tables. In my Spring - Boot application,i need to query to those tables,there are a couple of tables that wont change ever.

For example,lets suppose for simplicity it s a Book table,and i query the books in different ways,by price,by id,by ISBN ,what ever.

So first thing i thought ,it s to use Redis,but that s not good for me.Why?

Well,Redis stores the data in a key-value pair,so if i catch the entire table,then in my code when i want to do same complex query to that data (Give me the book with this ISBN),that s not possible,i will need to create different Catched methods for each operations,so the next time i ask for same data ,if exist in the cache,it wont go to query to the Database.

Thats why i though about H2 memory database,i could fill my "Book" in memory table and make all kind of operation on it,because it works like a normal database and i could query anything.

Now,comes my questiion:

I know i can load initial data into H2 pointing to some script,that s ok. But i would like to populate my "Book" in memory database,with the same data that i already have in my SQL Server Book table.

What do you think? Is that possible?Any ideas?

Thanks in advance!!
 
Rancher
Posts: 833
19
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your tables are sufficiently small and you don't have much change in the local table, then yes, it is possible.  I've not followed that very closely as the tables I deal with are hundreds of millions of records to billions of records, with change rates that are way too frequent to make a local copy practical.
 
Ale Garcc
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Les Morgan wrote:If your tables are sufficiently small and you don't have much change in the local table, then yes, it is possible.  I've not followed that very closely as the tables I deal with are hundreds of millions of records to billions of records, with change rates that are way too frequent to make a local copy practical.



You did not answer what i asked.
 
Bring out your dead! Or a tiny ad:
Enterprise-grade Excel API for Java
https://products.aspose.com/cells/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!