So i’ve been working with postgre databases and I noticed that it throws an error sometimes when I try to read a csv file and copy to a table remotely. It works perfectly when I use a buffered reader but i’m trying to see if there’s a way i can get i to work using the databases COPY FROM method. It works perfectly on the computer where the database is located but my other computer gets an error. I modififed the pg_hba file to accept ip addresses from any computer.
pg_hba file:
host all all * md5
Error occurs in this line:
st.execute("COPY INPUTDATA FROM 'C:\Users\JAMES\Downloads\V24_Mike_110217_RemovedReturnTrips\RyderCombiner\AllNonMatchingWithColNames.csv' CSV HEADER DELIMITER ',';");
Here’s where I connect to database:
Class.forName("org.postgresql.Driver"); Connection conn = DriverManager.getConnection("jdbc:postgresql://192.168.1.15:5432/postgres", "postgres", "pass");
I read online that maybe STDIN can possibly help me but I haven’t been able to get it to work and most examples online are using pqsl. Is there a way I can get tthis to work or do I need to go back to buffered readers?