Details
Description
I've tried running Sqoop with the --direct option to import from PostgreSQL but always got the following error message:
psql: could not translate host name "localhost" to address: Servname not supported for ai_socktype
This is the command I used:
sqoop import --direct --connect "jdbc:postgresql://localhost/osm" --username osm --password osm --table node_tags --hive-import
The problem is the handling of a missing port in the JDBC Url here: http://github.com/cloudera/sqoop/blob/master/src/java/com/cloudera/sqoop/manager/DirectPostgresqlManager.java#L357
If a host is provided but no port the tool will build a command line like this: psql --tuples-only --quiet --username osm --host localhost --port -1 osm -f /tmp-foobar.sql
which is obviously wrong.