Re: Re: Support for H2Database
Anthony Berglas <[email protected]>
| Newsgroups | gmane.comp.java.orm.simpleorm |
|---|---|
| Message-ID | <[email protected]> |
Hello Harry,
Thanks for that.
But before I include your code, what about the other things in
SDriverHSQL? In particular, is the support for SEQUENCES the same in
H2 as it is in HSQL? Did you remove the code deliberately?
Your loading code is OK, but if you look at the beginning of
SDriver.java you will see where drivers are loaded
automatically. I'll do that when your done.
Anthony
At 07:25 PM 23/09/2008, you wrote:
>Hi,
>
>I've been using this just as you described, and it works fine.
>Here is the class I use :
>
>package org.hmn.jrsd.demo;
>
>import simpleorm.drivers.SDriverHSQL;
>import simpleorm.sessionjdbc.SDriver;
>
>/*
>*
>* Cree par Harry Karadimas a 9 sept. 08
>*/
>/**
>* The H2 is mostly HSQL (H2 is a fork, by the original author of HSQLDB)
>*/
>public class H2Driver
>extends SDriverHSQL
>{
>@Override
>protected String driverName() {
>return "H2 JDBC Driver";
>}
>
>}
>
>To use the driver, it must first be registered when the
>application starts :
>
>//we register the H2 driver
>new H2Driver().registerDriver();
>
>You can then connect to the H2 database as usual :
>
>try {
>Class.forName("org.h2.Driver");
>driverLoaded = true;
>}
>catch (Exception ex) {
>throw new SQLException("Could not load H2 driver ("+ex+")");
>}
>Connection cxn = DriverManager.getConnection(url, user, password);
>
>I don't really know if that is the best way to do it, however.
>
>Harry
>
>--- In
><mailto:SimpleORM%40yahoogroups.com>[email protected],
>Anthony Berglas <anthony@...> wrote:
> >
> > Have not done this yet. But if you copy the HSQL driver it should
> > only require trivial changes. SimpleORM minimizes database
>dependent code.
> >
> > If you do this and it runs through the test cases then please post it
> > back to the list and I'll add it to the source.
> >
> > Anthony
> >
> > At 06:15 AM 23/09/2008, alspaughb wrote:
> > >Does SimpleORM support H2Database? I can't find an SDriver subclass
> > >for it.
> > >
> > ><http://www.h2database.com>http://www.h2database.com
> > >
> > >I like the fact that H2 is lightweight, pure Java, and supports multi
> > >version concurrency.
> > >
> > >Bruce
> >
> > Dr Anthony Berglas, anthony@... Mobile: +61 4 4838 8874
> > Just because it is possible to push twigs along the ground with ones
>nose
> > does not necessarily mean that is the best way to collect firewood.
> >
>
>
Dr Anthony Berglas, [email protected] Mobile: +61 4 4838 8874
Just because it is possible to push twigs along the ground with ones nose
does not necessarily mean that is the best way to collect firewood.
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/SimpleORM/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/SimpleORM/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[email protected]
mailto:[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/