Hi Francisco, Thanks for your response. I would try this out and give you feedback.
On Tue, Sep 12, 2017 at 12:00 PM, Francisco Olarte <fola...@peoplecall.com> wrote: > On Tue, Sep 12, 2017 at 12:30 PM, Osahon Oduware <osahon....@gmail.com> > wrote: > > 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 > > > > 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? > > You are invoking server side copy. This means the SERVER neads to be > able to access the file under the name you've given to it. > > The network path you have given is valid on windows machines ( UNC > path? It's been a decade an a half since Iast used windows ), but not > on linux. Typically on linux you mount the shared folder /some/where > and type the path as /some/where/path/to/csv/test.csv. > > You may be needing a CLIENT copy. I do not see which client program > you are using, it may be some fancy GUI stuff, in which case I cannot > help you. If you are using the standard "psql" tool you can just use > \copy. As explained in the docs this just does "copy from stdin" ( or > to stdout ) on the client side and redirects the file you give in the > command line ( or you can issue a [psql ... -c "copy ...from stdin"] > in a command line and feed the file via shell redirections, but, IIRC, > windows shells are terrible at quoting arguments and redirecting i/o, > so it may be better to avoid it). > > Francisco Olarte. >