db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John H. Embretsen" <John.Embret...@Sun.COM>
Subject Re: Embedded or Network Framework?
Date Thu, 09 Aug 2007 17:08:34 GMT
Teja wrote:
> Thanks Manjula, John and Bryan; Not very clear yet, but in my situation of a
> web server( strictly, application server) and a java app (actually a media
> server app.. serves flash video files basically and lots of other
> functionality)
> both on the same machine (and hence only one JVM in its normal definition)
> where java app loads the web server (web server is shutdown when java app
> shuts down)
> ,  so in this situation, I think embedded framework will suffice (as long as
> the java app 'load's the embedded driver before web server is loaded and
> none of the web apps try to 'load' the derby embedded driver again.).
> I think I should be able to simultaneously (from the java app and also from
> any http requests to the web apps) be able to access/modify same database
> (will be booted by java app once after the driver is loaded)
> without any fears of data corruption..

I think one important thing to be aware of here is what the 
documentation means when it speaks of a JVM.

For example, even though you may have only one JDK or JRE installed on 
your system, you will create a new JVM instance every time you use the 
"java" command (the command could be something else, depending on JVM 
vendor etc.). That is, you start a new Java Virtual Machine (JVM) every 
time you invoke the Java launcher (e.g. "java").

The last part of the documentation paragraph you quoted in a previous 
post describes a scenario where the user's Java application accesses the 
database from one JVM instance (e.g. "java MyApp"). Then, if you try to 
access the database from another JVM (instance), say the ij tool, you 
may corrupt the database (but you will most likely be stopped (getting 
an exception with a warning) before it goes that far).

In some environments with "complex" classloading this gets a bit more 
fuzzy, as Bryan mentioned, since the built-in multi-boot prevention 
mechanisms may be fooled.

However, having multiple concurrent connections to the same database 
from the same JVM in a pure embedded framework, is safe.
In any case you should back up your database regularly, in case 
something happens.

Feel free to ask if you have more questions after your try-outs...


View raw message