> jdbc:h2:mem:;MULTI_THREADED=1
This will create a separate database for each connection. Is this what
you want? In that case you can only have one connection per database.
See also http://www.h2database.com/html/features.html#database_url and
http://www.h2database.com/html/features.html#memory_only_databases
If you want to share the same database, you need to give it a name as in:
jdbc:h2:mem:test1;MULTI_THREADED=1
Regards,
Thomas
> Let's say: jdbc:h2:mem:testdb;MULTI_THREADED=1
> Yes, as you proposed, i just wanna to share the same database (with database
> name) to several threads in the application.
This should work (it works for me).
> The question is: whether it's possible to monitor the database "testdb"
> condition from an external tool?
Yes, but then you need to start the server from within the same
process that created the database. See "Mixed Mode" in:
http://www.h2database.com/html/features.html#connection_modes
> I tried to connect to "testdb" during the
> execution of the application, using:
> "java -cp h2-1.1.107.jar org.h2.tools.Server"
This doesn't work, because you started the server from a different
process. You have two processes:
1) your application
2) the server
You need to combine them:
1) your application + the server
Therefore you can't use the Server tool. You need to start the server
from within your application, see also
http://www.h2database.com/html/tutorial.html#using_server "Starting
the Server within an Application".
Regards,
Thomas