[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LocalDatabase and multiple threads in Servlet environment



On Sat, 03 Mar 2001, Nathan Eric Probst wrote:
> Hello all,
> 
> I'm just aquainting myself with Ozone, and, so far, I'm very impressed.
> 
> My intended use is as the backend for a Servlet/JSP based website.  This site will
> be hosted by a third party, in a private JVM.  So, I have to be able to run the
> Ozone server in the same JVM as Tomcat.  My first thought was to use the
> LocalDatabase implementation, but I have a concern.  I don't see a way to access a
> LocalDatabase through multiple connections from distinct threads.  Can this be
> done?  If not, is there a way to run the Ozone server in the same JVM and access
> it with RemoteDatabase?

Hmmm... you can use LocalDatabase in a multithreaded environment just like
RemoteDatabase. 

The ozone API does not have 'connections' (like JDBC) that can be controlled by
the client. ozone connections are internally handled by ExternalDatabase.
ExternalDatabase manages a pool of connections that are mapped to threads.
That is, in contrast to JDBC in ozone you are specifying the db 'connection'
you want to use by simple doing the work in the right thread. Therefore each
thread is mapped to one or no connection at any given point in time. This
mapping is automatically handled by ExternalDatabase and works for
RemoteDatabase as well as for LocalDatabase.

Conclusion: you don't need to care about connections. In an environment
where one thread maps to one transaction (in your servlet env this probably is
the case) you can use LocalDatabase exactly like you would use RemoteDatabase.


Falko
-- 
______________________________________________________________________
Falko Braeutigam                              mailto:falko@smb-tec.com
SMB GmbH                                        http://www.smb-tec.com