db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Embretsen <John.Embret...@Sun.COM>
Subject Re: Embedded or Network Framework?
Date Thu, 09 Aug 2007 15:07:14 GMT
Teja wrote:

> Can someone confirm this:
> 
> In my java app, on startup or so, I 'load' the embedded derby driver, so the
> database is ready to be used by the java app. But I also launch the web
> server (separate thread) through the same app, so the web server is still
> running in the same JVM(?).

Yes.

> And then there is a web app which accesses teh database (through the web
> server ofcourse (?)).
> So in my web app database classes, can I just ignore the 'load' driver
> line.. Class.forName(..); and proceed directly with the embedded connection
> urls to access the db tables?

I would think so, unless there is some complex classloading trickery going on
here... Why not just try and see ;)

> Note that at any given time, both the web app and java app will be accessing
> the same database. In such scenario, can someone confirm that there will be
> no data corruption and Embedded framework will take care of transactional
> safety and such?

As long as the DB is accessed from the same JVM, you should be safe from this
particular issue. If you are using a relatively new JVM and a relatively new
Derby version, I think there are mechanisms in place to prevent you from booting
the same DB in more than one JVM at once.

>> On 8/9/07, Teja Palla <teja@synapse.ws> wrote:
>>> So my question is, what framework needs to be used? will embedded
>>> framework suffice because I see only one JVM here? Please advise..

I think embedded will suffice. Also, with embedded you avoid the overhead of
sending network traffic back and forth to the database server.

If, at a later stage, you find out that you need to connect to the database from
multiple JVMs, you can always extend using an embedded server (see [1] for an
explanation) instead, or a standalone server for that matter.


-- 
John

[1]: http://db.apache.org/derby/papers/DerbyTut/ns_intro.html#Embedded+Server




Mime
View raw message