Re: PostgreSQL COPY Statement Error On Linux

From: Osahon Oduware <osahon(dot)gis(at)gmail(dot)com>
To: Charles Clavadetscher <clavadetscher(at)swisspug(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PostgreSQL COPY Statement Error On Linux
Date: 2017-09-12 16:27:35
Message-ID: CAGpiUShHe9h5tVnmMYN47_Zeuz-S82kY3_FWgOgaUN7Zkt9zAg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Charles,

Thanks for your response. I would try this out and give you feedback.

On Tue, Sep 12, 2017 at 12:01 PM, Charles Clavadetscher <
clavadetscher(at)swisspug(dot)org> wrote:

> Hello
>
>
>
> *From:* pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner@
> postgresql.org] *On Behalf Of *Osahon Oduware
> *Sent:* Dienstag, 12. September 2017 12:30
> *To:* pgsql-general(at)postgresql(dot)org
> *Subject:* [GENERAL] PostgreSQL COPY Statement Error On Linux
>
>
>
> Hi All,
>
> I am trying to utilize the "COPY" statement below to copy a .CSV file to a
> table in a PostgreSQL database.:
> *COPY <schema>.<table_name>(<table_columns>) FROM
> '\\shared\network\path\to\csv\test.csv' DELIMITER ',' CSV HEADER;*
>
> This works with a PostgreSQL database installed in a WINDOWS environment
> (Windows 7), but fails with the following error with a similar PostgreSQL
> database in a Linux environment (Centos 7):
> *org.postgresql.util.PSQLException: ERROR: could not open file
> "\\shared\network\path\to\csv\test.csv" for reading: No such file or
> directory*
>
> It looks like the share is not visible for the Linux system. You probably
> need to mount it first using Samba and then access it through the mount
> point using slashes instead of bakslashes: /
>
> Instructions on how to mount a Windows share in Linux can be found on the
> internet. Since I am not an expert on this myself, I can’t give you more
> concrete instructions.
>
>
>
> This may help: http://www.serverlab.ca/tutorials/linux/storage-file-
> systems-linux/mounting-smb-shares-centos-7/
>
>
>
> An alternative would be to copy the file to the Linux system using e.g.
> scp of sftp and the load it locally.
>
>
>
> Hope this helps.
>
> Bye
>
> Charles
>
>
> I have granted READ access to EVERYONE on the CSV folder on the network
> path as depicted in the attached image.
>
> Could someone point me to the reason for the failure in Linux?
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Osahon Oduware 2017-09-12 16:28:34 Re: PostgreSQL COPY Statement Error On Linux
Previous Message Jeff Janes 2017-09-12 16:19:07 Re: contrecord is requested