Re: Cayenne and H2 on the desktop

From: Michael Gentry (mgentr..asslight.net)
Date: Wed Oct 21 2009 - 09:37:28 EDT

  • Next message: Kevin Menard: "Re: Updating Cayenne Advice 1.x => 3.0: createAndRegisterNewObject is deprecated..."

    On Tue, Oct 20, 2009 at 11:56 PM, Eric Lazarus <ericllazaru..ahoo.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



    This archive was generated by hypermail 2.0.0 : Wed Oct 21 2009 - 09:38:19 EDT