Using H2 database while Development with Spring Boot is recomended? - database

I have a simple question if someone can use the H2 Database while development with spring boot and Spring Data JPA and after completing the development, shifting to database like oracle .?

You can use the in-memory database for production considering the limitations.
From Spring Docs (31.1.1),
It is often convenient to develop applications by using an in-memory embedded database. Obviously, in-memory databases do not provide persistent storage. You need to populate your database when your application starts and be prepared to throw away data when your application ends.
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-sql.html

It is IMHO OK until you need to do some performance testing. Performance of H2 is worse than that of, e.g., PostgreSQL and Oracle.

Related

why sync sql with elasticsearch

Some architectures keep data in an SQL database and sync it with Elasticsearch to support some advanced search options that Elasticsearch is good at, but if they do that, what is the reason to keep the data in the SQL database? After all, you can create, read, update and delete in in ES also.
Thanks.
I can see reasons for keeping it in SQL if your architecture was built around for example you might be using an MVC framework like Laravel or Django that plays nice with sql and the relational db architecture.

Is an ORM appropriate for a read-only application?

I am tasked with creating a reporting application working off a internal database.
The database is populated by some other tools, and the aim of the application is basically to read from the DB, and display some charts.
To that end, the application will only ever connect with a read-only account.
I have been reading about ORM, especially Entity Framework, but is seems to be very focused of making DB structure, and DB updating easier.
Since the only purpose of the app is reading from the DB, will I gain anything from using an ORM such as Entity Framework or Linq2SQL, or should I stick with good-ol' SqlCommands?
If you need some kind of dashboard to display aggregated data from a SQL Server database I would recommend Reporting Services. You would need a SQL Server license on the machine that serves the site.
You can of course create a dashboard from scratch using Entity Framework, but hey, why reinvent the wheel?

JPA eclipselink cache and DB replication

we currently have a java based application which uses JPA via eclipselink against a single MS sql server, this is running on a system in the internal network.
This works fine.
Now we need to add a second instance of the sql database in a DMZ with it's own application and JPA eclipselink. (External access to a subset of the application)
Both applications should see the same data, which means I will have to do some replication between the two.
MS SQL has a merge replication system for this which would cover our needs.
But here I struggle with the JPA cache.
When the data is changed directly by the db replication, how/when do I invalidate the local jpa cache?
Or is there a java/jpa/jdbc based replication available for such setups?
Any other ideas on how to handle such a situation?
EMF L2 cache is cleared using
emf.getCache().evictAll()

Using Grails internal DB

I am creating an application using Grails Framework for which I plan to use the database which is provided by Grails.
Just wanted to be sure of the advantages/disadvantages before proceeding.
Does using the internal database invite issues?
Thanks!
By default, Grails has an in-memory database, which means, that whenever you shut down your application, all your data is lost... probably not what you want.
You could change this to a file-database, and this file-database would by default end up in your Grails application root. If you deploy this to an app server and undeploy again, your data is lost... again, probably not what you want.
I would recomend installing a MySql database. It's easy, and you have your data separate from your application.
The internal database is an in-memory database, so all your data disappears when the server is restarted. It seems very unlikely that you would want this behaviour for a real application, so I recommend MySQL, Postgres (or similar) instead.

Sqlite db scheme to Django models

I am trying to get my local sqlite db up and running on GAE. According to this post, there is no way for me to get my local db up there directly. That's why I would like to do something like this:
I get the sqlite db up and running on my dev server with this: http://code.google.com/p/gae-sqlite/
Locally, I translate the db scheme into django model and migrate the db into GAE db.
I use google's way to get my data up to GAE.
So here comes my question. Is there any project that is able to directly translate sqlite db scheme into django model directly?
If not, I guess I will have to write up a code gen.
Thanks
gae-sqlite (now superceded by built-in sqlite support) is designed to run the development appserver backend on sqlite for speed and reduced memory consumption. It doesn't let you import or use your own sqlite schema in App Engine.
You need to dump your data to CSV files, and use the App Engine bulkloader (which you linked to) to bulkload them into the dev_appserver and production environments. Alternately, it is possible to bulkload direct from the sqlite database, but that's a lot more involved, and probably not worth the effort.

Resources