Problems exporting data with osmosis

Hii!!

I’m new in this world, and I have found a problem and now I can’t continue!!
I’m tryin to export data from OSM (file.osm) to my postgreSQL database, but I can’t because it tells me that there’s a problem with the connection and he can’t connect with the database!

Here’s the code:

D:\SOFT\osmosis-0.35.1>bin\osmosis --read-xml file=“map.osm” --write-pgsql host=
“xxx” database=“extract_1” user=“routing” password=“xxx”
26-may-2010 12:20:52 org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.35.1
26-may-2010 12:20:52 org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
26-may-2010 12:20:52 org.openstreetmap.osmosis.core.Osmosis run
INFO: Launching pipeline execution.
26-may-2010 12:20:52 org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline executing, waiting for completion.
26-may-2010 12:21:13 org.openstreetmap.osmosis.core.pipeline.common.ActiveTaskMa
nager waitForCompletion
GRAVE: Thread for task 1-read-xml failed
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to establish a da
tabase connection.
at org.openstreetmap.osmosis.core.pgsql.common.DatabaseContext.getConnec
tion(DatabaseContext.java:80)
at org.openstreetmap.osmosis.core.pgsql.common.DatabaseContext.createSta
tement(DatabaseContext.java:169)
at org.openstreetmap.osmosis.core.pgsql.common.SchemaVersionValidator.va
lidateDBVersion(SchemaVersionValidator.java:72)
at org.openstreetmap.osmosis.core.pgsql.common.SchemaVersionValidator.va
lidateVersion(SchemaVersionValidator.java:52)
at org.openstreetmap.osmosis.core.pgsql.v0_6.PostgreSqlWriter.initialize
(PostgreSqlWriter.java:237)
at org.openstreetmap.osmosis.core.pgsql.v0_6.PostgreSqlWriter.process(Po
stgreSqlWriter.java:875)
at org.openstreetmap.osmosis.core.xml.v0_6.impl.NodeElementProcessor.end
(NodeElementProcessor.java:117)
at org.openstreetmap.osmosis.core.xml.v0_6.impl.OsmHandler.endElement(Os
mHandler.java:107)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source
)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unkn
own Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElemen
t(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Sour
ce)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.openstreetmap.osmosis.core.xml.v0_6.XmlReader.run(XmlReader.java:
108)
at java.lang.Thread.run(Unknown Source)
Caused by: org.postgresql.util.PSQLException: Conexi¾n rechazada. Verifique que
el nombre del Host y el puerto sean correctos y que postmaster este aceptando co
nexiones TCP/IP.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(Conne
ctionFactoryImpl.java:123)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactor
y.java:66)
at org.postgresql.jdbc2.AbstractJdbc2Connection.(AbstractJdbc2Conn
ection.java:124)
at org.postgresql.jdbc3.AbstractJdbc3Connection.(AbstractJdbc3Conn
ection.java:30)
at org.postgresql.jdbc4.AbstractJdbc4Connection.(AbstractJdbc4Conn
ection.java:29)
at org.postgresql.jdbc4.Jdbc4Connection.(Jdbc4Connection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:386)
at org.postgresql.Driver.connect(Driver.java:260)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.openstreetmap.osmosis.core.pgsql.common.DatabaseContext.getConnec
tion(DatabaseContext.java:69)
… 21 more
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.(Unknown Source)
at java.net.Socket.(Unknown Source)
at org.postgresql.core.PGStream.(PGStream.java:62)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(Conne
ctionFactoryImpl.java:77)
… 31 more
26-may-2010 12:21:13 org.openstreetmap.osmosis.core.Osmosis main
GRAVE: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: One or more tasks failed
.
at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForComple
tion(Pipeline.java:146)
at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:85)
at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:30)
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(Laun
cher.java:329)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:239)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
at org.codehaus.classworlds.Launcher.main(Launcher.java:31)

The name of the host, user, password and database are correct!! I’m 100% sure.
Console says me that I need to revise the number of my ports. How can I explain the port that I want to be connected?

The problem has been solved!!

Thank you all anyway!! :slight_smile:

How did u solve this?

Hello Farhan_am - the original question was asked back in 2010, so how the original questioner solved it might not be relevant any more.

Whatever your problem is, I’m sure that people will be able to help - try asking a new question in the help and support forum explaining what you’re trying to do and what you’ve tried so far.