Doc for running GeoDB as an extension to H2

287 views
Skip to first unread message

Martin Davis

unread,
Aug 24, 2011, 4:52:59 PM8/24/11
to geodb
Hi, Justin. Great that you gave my last email such prompt
attention.

Since we're on a roll here... HenPlus is great for quick access to
the DB, and for simple demos. But what I'd really like to do is to
run H2 as a server, so that I have access to the various client/server
interfaces (such as the web GUI, and JDBC). I presume this is
possible - but does it require jiggling the out-of-the-box GeoDB
install at all? It would be nice to have some doc showing how to do
this.

Martin

Justin Deoliveira

unread,
Aug 24, 2011, 5:23:06 PM8/24/11
to ge...@googlegroups.com
Hi Martin,

Actually if you run the geodb command with the "-w" parameter it will fire up h2 in server mode that accepts three types of connections. 

1. web: webapp that runs a console application
2. tcp: straight tcp connections, from jdbc or wherever else
3. pg: a postgresql connection emulator

Each of those modes has its own options... which the geodb startup script doesn't really expose. So what we should do is tweak that script to accept arbitrary options to be passed through to the h2 server.

Creating an issue for this one.


-Justin

--
Justin Deoliveira
Enterprise support for open source geospatial.

Martin Davis

unread,
Aug 24, 2011, 5:37:12 PM8/24/11
to geodb
Ok, that's cool.

Is there any reason that GeoDB can't just be installed as a straight
extension to H2? What is it doing when it starts up?

On Aug 24, 2:23 pm, Justin Deoliveira <jdeol...@opengeo.org> wrote:
> Hi Martin,
>
> Actually if you run the geodb command with the "-w" parameter it will fire
> up h2 in server mode that accepts three types of connections.
>
> 1. web: webapp that runs a console application
> 2. tcp: straight tcp connections, from jdbc or wherever else
> 3. pg: a postgresql connection emulator
>
> Each of those modes has its own options... which the geodb startup script
> doesn't really expose. So what we should do is tweak that script to accept
> arbitrary options to be passed through to the h2 server.
>
> Creating an issue for this one.
>
> https://github.com/jdeolive/geodb/issues/8
>
> -Justin
>
> On Wed, Aug 24, 2011 at 2:52 PM, Martin Davis <mtncl...@gmail.com> wrote:
> > Hi, Justin.  Great that you gave my last email such prompt
> > attention.
>
> > Since we're on a roll here...  HenPlus is great for quick access to
> > the DB, and for simple demos.  But what I'd really like to do is to
> > run H2 as a server, so that I have access to the various client/server
> > interfaces (such as the web GUI, and JDBC).  I presume this is
> > possible - but does it require jiggling the out-of-the-box GeoDB
> > install at all?  It would be nice to have some doc showing how to do
> > this.
>
> > Martin
>
> --
> Justin Deoliveira
> OpenGeo -http://opengeo.org

Justin Deoliveira

unread,
Aug 24, 2011, 5:55:24 PM8/24/11
to ge...@googlegroups.com
On Wed, Aug 24, 2011 at 3:37 PM, Martin Davis <mtnc...@gmail.com> wrote:
Ok, that's cool.

Is there any reason that GeoDB can't just be installed as a straight
extension to H2?  What is it doing when it starts up?

Yup, for sure,  again this should be documented but all it does is register a bunch of function aliases with H2. If you look at this script [1] you will see how it works. The InitGeoDB() function essentially just runs this script.

So as long as geodb is on the classpath the steps to "spatialize" an h2 database are essentially the first two commands from the quickstart:

@h2> CREATE ALIAS InitGeoDB for "geodb.GeoDB.InitGeoDB";
@h2> CALL InitGeoDB();

-Justin







--
Justin Deoliveira

Martin Davis

unread,
Aug 24, 2011, 5:58:25 PM8/24/11
to geodb
I just looked at the code (that's what us coders are supposed to do,
right?!)

So it looks like if -w is specifed, geodb just calls the H2 Server
class.

Would it not be an option just to call this class directly from the
java cmd, in order to provide a "clean" process (i.e. with GeoDB just
an extension to H2)

Martin Davis

unread,
Aug 24, 2011, 5:59:41 PM8/24/11
to geodb
Ok, sounds good. As you see from my overlapping msg I was on my way
to realizing the same thing... 8^)

M

On Aug 24, 2:55 pm, Justin Deoliveira <jdeol...@opengeo.org> wrote:
> On Wed, Aug 24, 2011 at 3:37 PM, Martin Davis <mtncl...@gmail.com> wrote:
> > Ok, that's cool.
>
> > Is there any reason that GeoDB can't just be installed as a straight
> > extension to H2?  What is it doing when it starts up?
>
> Yup, for sure,  again this should be documented but all it does is register
> a bunch of function aliases with H2. If you look at this script [1] you will
> see how it works. The InitGeoDB() function essentially just runs this
> script.
>
> So as long as geodb is on the classpath the steps to "spatialize" an h2
> database are essentially the first two commands from the quickstart:
>
> @h2> CREATE ALIAS InitGeoDB for "geodb.GeoDB.InitGeoDB";
> @h2> CALL InitGeoDB();
>
> -Justin
>
> [1]https://github.com/jdeolive/geodb/blob/master/core/src/main/resources...
Reply all
Reply to author
Forward
0 new messages