+1 

On Friday, May 18, 2012 6:37:08 AM UTC-7, Thomas Mueller wrote:
> Maybe I will change the code to use a
> connection pool, or having the option of a connection pool.
> 
> Regards,
> Thomas



On Friday, May 18, 2012 6:37:08 AM UTC-7, Thomas Mueller wrote:
> Hi,
> 
> > this means that when I get a connection from the servletContext, I get
> > a non-pooled connection, and always the same one is used.
> 
> Yes.
> 
> > - it is safe to access the same connection from multiple threads?
> 
> No.
> 
> > How this works with transactions?
> 
> If you use transactions, you have to synchronize on the connection.
> 
> > what happens if programmers calls connection.close() after usage
> 
> Then the connection is closed.
> 
> > - why not using a servletContext.setAttribute("pool", connectionPool),
> > which looks more suitable -to me- for a web application?
> 
> You can do that of course.
> 
> > Am I missing something special that makes this approach valid for H2 ?
> > (and invalid for all other databases I know of)
> 
> Both approaches are valid for any database. Using a ConnectionPool is
> nice, and has advantages. Maybe I will change the code to use a
> connection pool, or having the option of a connection pool.
> 
> 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/-/wJhr4ccD2LEJ.
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.

Reply via email to