[Routing] Travelling Salesman: issue with using H2 Database

Nick Whitelegg nick_whitelegg at yahoo.co.uk
Fri Aug 6 18:01:09 BST 2010


Hi,

I've developed a custom application which uses the Travelling Salesman libraries 
to do some custom routing. I've got it working fine when I use .osm files, but 
am running into a problem when using the H2 database.

I imported a .osm file into an H2 database using the actual Travelling Salesman 
GUI application, then connect to it from my app, from what I gather, the 
following is correct:

H2DataSet map = new H2DataSet (new File("/home/nick/qs/db/LOD0"));

where the H2 database is inside the "db" directory - which is a copy of 
~/.openstreetmap/map.

(I also tried without the LOD0, but that couldn't find the database at all)

However, the following line produces an exception:

 Iterator<Way> parks = map.getWaysByTag("leisure","park");

specifically:

06-Aug-2010 17:51:42 org.openstreetmap.osm.data.h2.H2DataSet getWaysByTag
SEVERE: Cannot get way by id
org.h2.jdbc.JdbcSQLException: Column "version" not found [42122-126]
    at org.h2.message.Message.getSQLException(Message.java:110)
    at org.h2.message.Message.getSQLException(Message.java:121)
    at org.h2.message.Message.getSQLException(Message.java:74)
    at org.h2.jdbc.JdbcResultSet.getColumnIndex(JdbcResultSet.java:2987)
    at org.h2.jdbc.JdbcResultSet.get(JdbcResultSet.java:3038)
    at org.h2.jdbc.JdbcResultSet.getInt(JdbcResultSet.java:314)
    at 
org.openstreetmap.osm.data.h2.H2DataSet.getWaysFromQuery(H2DataSet.java:1722)
    at org.openstreetmap.osm.data.h2.H2DataSet.getWaysByTag(H2DataSet.java:1774)
    at Test.main(Test.java:46)


Am I using the H2 database correctly? I'm not sure what relevance the "version" 
column has. Note that Travelling Salesman itself reloads the DB correctly but 
has more complex code to connect, as it has to be more flexible, and I'd like to 
keep things as simple as possible.

Thanks,
Nick


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/routing/attachments/20100806/abf4ee19/attachment.html>


More information about the Routing mailing list