[OSM-dev] Importing planet.osm into api0.5 db?

Brett Henderson brett at bretth.com
Thu Oct 4 10:28:18 BST 2007

Jon Bright wrote:
> Hi Brett,
> Brett Henderson wrote:
>> I haven't released a new version of osmosis but it is all available 
>> in svn if you wish to compile it yourself.  Just run ant in the 
>> applications/utils/osmosis directory.
> I've done this and then set it running on the 0.5 planet, thus:
> java -jar osmosis.jar --read-xml-0.5 file="planet-api05-070927.osm" 
> --write-mysql-0.5 host="..." database="..." user="..." password="..."
> I see this exception:
> Exception in thread "Thread-1-read-xml-0.5" 
> com.bretth.osmosis.core.OsmosisRuntimeException: Unable to bulk insert 
> nodes into the database.
>         at 
> com.bretth.osmosis.core.mysql.v0_5.MysqlWriter.flushNodes(MysqlWriter.java:551) 
>         at 
> com.bretth.osmosis.core.mysql.v0_5.MysqlWriter.process(MysqlWriter.java:1006) 
>         at 
> com.bretth.osmosis.core.container.v0_5.NodeContainer.process(NodeContainer.java:34) 
>         at 
> com.bretth.osmosis.core.mysql.v0_5.MysqlWriter.process(MysqlWriter.java:986) 
>                                                  at 
> com.bretth.osmosis.core.xml.v0_5.impl.NodeElementProcessor.end(NodeElementProcessor.java:99) 
>                                  at 
> com.bretth.osmosis.core.xml.v0_5.impl.OsmHandler.endElement(OsmHandler.java:108) 
> ...
> Caused by: java.sql.SQLException: Incorrect string value: 
> '\xD8\xAE\xD8\xB1\xD9\x8A...' for column 'tags' at row 1        ...
> at 
> com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1303) 
>                                                   at 
> com.bretth.osmosis.core.mysql.v0_5.MysqlWriter.flushNodes(MysqlWriter.java:549) 
> Any idea what that might be?
Unfortunately no.  My first suspicion is always incorrect UTF8 data in 
the planet file but I suspect that's not the problem in this case.

Was any data inserted successfully?  If not I might have a problem with 
the insert statement.  If some was inserted successfully then perhaps 
the db is not configured correctly for UTF8.

I don't have that planet available to test it out, I'll have to download 
it.  Can you run the following command to make sure the data in the 
planet can be handled correctly?  It will verify that all data in the 
planet can be handled as UTF8.
java -jar osmosis.jar --read-xml-0.5 file="planet-api05-070927.osm" 
--write-xml-0.5 file="planet-api05-070927-out.osm"

More information about the dev mailing list