How to start H2 database in multithreaded way?

I am using H2 db (in memory mode with Java) and I hit the roadblock. I figured out that if I have multiple threads in Java, each thread executing the stored proc in H2, at the H2 level, everything works in sequence. In other words, while my Java client is multithreaded, H2 is not.

Now I see some people on the internet commenting that H2 can be run in multi-threaded mode. But I couldn't find specific steps / documentation / tutorial to make this happen. Can anyone help me please?

There are two specific answers that I am looking for

  • Can H2 work in a multithreaded way from a multithreaded Java client?
  • If this can someone point me to some stuff?

I have read the following links:

I know MULTI_THREADED=1

H2 is supposed to be started in a multithreaded fashion. However, I just don't feel like someone is saying that it worked for him / her. Or someone who has shared the steps on how / where to install MULTI_THREADED=1

.

Thanks for the help.

+3


source to share


1 answer


H2 with multithreaded application processing is currently "experimental" and should not be used. If you did even basic research , you would discover this fact. You can enable it with an option MULTI_THREADED

, but you cannot use MVCC.
I think this discussion has more information about the option



-1


source







All Articles