I use JDBC with local Postgres mail to copy data from CSV files to the database using the Postgres COPY command. I use Java to parse an existing CSV file in CSV format that matches the tables in the database. Then I save this parsed CSV to my local drive. Then I JDBC execute the COPY command using the parsed CSV for my local DB. Everything works as expected. Now I am trying to execute the same process in a Postgres database on a remote server using JDBC. However, when JDBC tries to execute COPY, I get
org.postgresql.util.PSQLException: ERROR: could not open file "C:\data\datafile.csv" for reading: No such file or directory
Do I understand correctly that the COPY command tells the database to look local to this file? I.E. the remote server is looking at its C: drive (does not exist).
If so, does it still tell the copy command to view it on my computer, and not "locally" on the remote computer? After reading the documentation on the copies, I did not find anything that would indicate this functionality.
If the functionality does not exist, I am thinking of just populating the entire database locally and then copying it to the database on the remote server, but I just wanted to verify that I did not miss anything.
Thank you for your help.
source
share