Uploaded image for project: 'Sqoop (READ-ONLY)'
  1. Sqoop (READ-ONLY)
  2. SQOOP-38

Direct PostgreSQL import only works when providing a port

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0
    • Fix Version/s: 1.1.0
    • Component/s: managers
    • Labels:
      None

      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.

        Attachments

          Activity

            People

            • Assignee:
              lars_francke Lars Francke
              Reporter:
              lars_francke Lars Francke
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: