Re: Digest for geodb@googlegroups.com - 1 Message in 1 Topic

52 views
Skip to first unread message

Coquelicot

unread,
Aug 24, 2010, 11:15:55 AM8/24/10
to ge...@googlegroups.com
Jan,

thanks for the tip. I am tring to use geodb with latest and greatest
addition to the Hibernate Spatial project - GeoDBDialect and I still
can't make it work. Here's what I try to do: I start the GeoDB using
'geodb -w', set up a sample database (I have tried both in-memory and
file-based) with username and password; then I put those values in my
hibernate.cfg.xml file (it contains correct dialect [GeoDBDialect]).
Then I start my application.

The result is that app complains that the version of the running H2
database is 'unsupported'. I know that it means that GeoDB didn't
spatially enable that database; the question is - how to do it from
the Hibernate?...

Big thanks,

Lukasz

On Mon, Aug 16, 2010 at 10:14 PM, <geodb+...@googlegroups.com> wrote:
>   Today's Topic Summary
>
> Group: http://groups.google.com/group/geodb/topics
>
> Which version of H2 database geodb works with? [1 Update]
>
>  Topic: Which version of H2 database geodb works with?
>
> Jan Boonen <jan.b...@geodan.nl> Aug 15 11:51PM -0700 ^
>
> Hi Lukasz,
>
> You can still run GeoDB as an in-memory database that uses the H2
> driver. The 'trick' is to set up a H2 in-memory database and then call
> the static method GeoDB.InitGeoDB(Connection conn).
>
> Code example:
>
> DriverManagerDataSource dataSource = new DriverManagerDataSource();
> // use the H2 JDBC driver
> dataSource.setDriverClassName("org.h2.Driver");
> // have it create an database in users's home directory
> dataSource.setUrl("jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1");
> dataSource.setUsername("sa");
> dataSource.setPassword("sa");
> // initialize datasource (ddl, test data, etc.)
> Connection cx = dataSource.getConnection();
> try
> {
> // spatially enable
> GeoDB.InitGeoDB(cx);
> ...
>
> This works very well for the integration tests that we use here at
> Geodan. Hope the example will work for you as well. If you use Spring
> for your integration tests, consider using the test factory that is in
> my public github repository:
> http://github.com/boonen/GeoDBTestDataSourceFactory
>
> Cheers,
>
> Jan
>
>
>
>

Coquelicot

unread,
Aug 24, 2010, 12:20:19 PM8/24/10
to ge...@googlegroups.com
Jan,

please disregard the problem mentioned about about 'unsupported' H2
database files; it was caused by incorrect version of H2 JAR that I
was using in my application. Sorry for confusion!

I still can't make Hibernate connect to the GeoDB though; I am getting
familiar 'No Dialect mapping for JDBC type: 2003' exception.

Best greetings,


Lukasz

Justin Deoliveira

unread,
Aug 24, 2010, 12:23:17 PM8/24/10
to ge...@googlegroups.com
Hi Lukasz,

2003 looks like it is an array type. What is the schema of the table you are trying to map? Also how does your GeoDB dialect work? Does it extend the regular H2 one?

-Justin

Jan Boonen

unread,
Aug 25, 2010, 3:01:53 AM8/25/10
to geodb
Hi Lukasz,

Thanks for the compliment ;-) We've had fun writing the GeoDBDialect
for HS and using it in one of our larger projects to maintain a high
quality level of our DAO layer.

I'm afraid I don't exactly understand what you mean with "how to do it
from
the Hibernate?..." Could you send a small code example of what you are
trying to do?

Cheers,

Jan
Reply all
Reply to author
Forward
0 new messages