Hi, Thomas: My understanding is that if I do not care about other databases, I could just use one single connection object for multiple threads, correct? Is it also true if I set *MULTI_THREADED*=1 ? If it is, then do I really need the connection pool at all?
Thanks in advance. On Saturday, October 18, 2008 5:14:37 AM UTC-4, Thomas Mueller wrote: > > Hi, > > > is it ok to reuse one connection with multiple threads? Is the H2 > > connection thread-safe? > > I will add the following paragraph to the Javadocs of Connection: > > * Thread safety: This database is thread-safe, because it synchronizes > access > * to the connection. However, for compatibility with other databases, a > * connection should only be used in one thread at any time. > > > could it be when I open the database in > > the read-only mode? > > No, because even a read-only database can have state: you can create > local temporary tables and variables (SET @X=10 and so on). But you > can use multiple connections in read-only mode of course. > > What is your use case? > > Regards, > Thomas > > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/RPK8Gu171NgJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
