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
>
>
>
>
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