Hi, I think the documentation is quite clear.
Of course in Java, you can pass around objects to any thread you like. If your application has a handle on an object, you can also call methods on it concurrently in multiple threads. H2 is thread-safe (as documented), but there are parts of the JDBC API that are problematic, for example it doesn't make sense to call PreparedStatement.setString + execute concurrently on the same object. But that has nothing to do with H2. Regards, Thomas On Monday, October 7, 2013, Laird Nelson wrote: > On Monday, October 7, 2013 2:41:21 PM UTC-7, Laird Nelson wrote: > >> The documentation says that connecting to the JDBC URL "jdbc:h2:mem:" >> creates a "private" in-memory database. >> >> Is the database so created private to the thread that creates it? >> > > To be clear, I'm aware of this documentation paragraph as well: > > "In some cases, only one connection to a in-memory database is required. > This means the database to be opened is private. In this case, the database > URL is jdbc:h2:mem: Opening two connections within the same virtual > machine means opening two different (private) databases." > > I just want to make sure that two connections in two *threads* in the > same VM each get a database scoped to that thread. > > Best, > Laird > > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/h2-database. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/groups/opt_out.
