I'm trying to import OSM data into MySQL and get stuck at this error. Below is the full output. This is a Windows 7 x64 machine with a fresh MySQL install. I just created a database named osm
and nothing more. Then, I executed this command:
osmosis --read-pbf D:\osm\germany.osm.pbf --write-apidb dbType=mysql host=localhost database=osm user=root password=xxx
And I get the following output:
okt 09, 2012 10:13:44 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.41
okt 09, 2012 10:13:44 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
okt 09, 2012 10:13:44 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Launching pipeline execution.
okt 09, 2012 10:13:44 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline executing, waiting for completion.
okt 09, 2012 10:13:44 PM org.openstreetmap.osmosis.core.pipeline.common.ActiveTaskManager waitForCompletion
SEVERE: Thread for task 1-read-pbf failed
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to create resultset.
at org.openstreetmap.osmosis.apidb.common.DatabaseContext.executeQuery(DatabaseContext.java:429)
at org.openstreetmap.osmosis.apidb.v0_6.impl.SchemaVersionValidator.validateDBVersion(SchemaVersionValidator.java:82)
at org.openstreetmap.osmosis.apidb.v0_6.impl.SchemaVersionValidator.validateVersion(SchemaVersionValidator.java:55)
at org.openstreetmap.osmosis.apidb.v0_6.ApidbWriter.initialize(ApidbWriter.java:324)
at org.openstreetmap.osmosis.apidb.v0_6.ApidbWriter.process(ApidbWriter.java:1089)
at crosby.binary.osmosis.OsmosisBinaryParser.parse(OsmosisBinaryParser.java:247)
at crosby.binary.BinaryParser.handleBlock(BinaryParser.java:64)
at crosby.binary.file.FileBlock.process(FileBlock.java:135)
at crosby.binary.file.BlockInputStream.process(BlockInputStream.java:34)
at crosby.binary.osmosis.OsmosisReader.run(OsmosisReader.java:45)
at java.lang.Thread.run(Unknown Source)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'osm.schema_migrations' doesn't exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2618)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1557)
at org.openstreetmap.osmosis.apidb.common.DatabaseContext.executeQuery(DatabaseContext.java:424)
... 10 more
okt 09, 2012 10:13:44 PM org.openstreetmap.osmosis.core.Osmosis main
SEVERE: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: One or more tasks failed.
at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForCompletion(Pipeline.java:146)
at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:92)
at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
What did I do wrong, and what should I do?
asked 09 Oct '12, 21:18

thany
11●1●1●2
accept rate: 0%
The thing is, Postgres doesn't do very well on Windows, but Windows is the most used OS out there (whether we like it or not). I do have a linux box that I can try it on, but it's not nearly as powerful as my windows box.
Even for Portgres, the documentation is not clear on how to populate the database initially. I'm not sure what exactly to do at that point. Partly because I'm not familiar at all with Postgres (I have literally never used it), and partly because it's just not very clear to me what needs to be done exactly.
Never used it myself, but a bit of poking on the wiki revealed that there should be something to generate the database structure in a directory named "script/contrib" with your osmosis download.
See: https://wiki.openstreetmap.org/wiki/Osmosis#DB_Schema