cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <mgen...@masslight.net>
Subject Re: Cayenne and H2 on the desktop
Date Wed, 21 Oct 2009 13:37:28 GMT
On Tue, Oct 20, 2009 at 11:56 PM, Eric Lazarus <ericllazarus@yahoo.com> wrote:
> Thanks, Folks!
>
> What 'adapter' do I use for H2 in cayenne.xml? What 'adapter' do I use for H2 in cayenne.xml?
I imagine it will be something like cayenne.dba.H2.H2Adapter?

Cayenne should auto-guess the adapter.  I should've mentioned that you
should plug the driver into Cayenne Modeler, too.

JDBC Driver: org.h2.Driver

And do what Mike suggested and leave the username out.  I didn't know
that would work and it is probably better for your situation.

> About the meaning of 'embedded': I think that the 2nd option has a
> server process running tcp on some port number in the 9000's. Does this
> count as an 'embedded' database? I assume not.

Maybe if you wanted to get pedantic, you could argue that the DB is
still embedded in the application, but when it runs as a server, I
really don't consider that embedded.

> Also, what happens in the
> first case if the user opens two instances of the program on his
> desktop. Does not each instance access the same files ? What kind of
> locking is implemented in that case?

You can tell H2 to not lock the database, but you don't want to do
that.  According to the docs: "Please note that this is unsafe as
another process is able to open the same database, possibly leading to
data corruption."  I'm guessing you'd prefer using a SOCKET lock:

http://www.h2database.com/html/features.html#database_file_locking

> Thanks!
>
> Eric

Welcome!

mrg

Mime
View raw message