0

I'm using JMeter for insert summary data file to PostgreSQL.

I tried \copy instead of COPY but I'm getting error at \copy syntax.

I found out COPY is for only server-side, so I us \copy for client-side.

Here is my query

\copy Load(label,success,bytes,latency)
FROM '/Desktop/Summary/oca_sum.csv' DELIMITER ',' CSV HEADER;

Here is the error:

org.postgresql.util.PSQLException: ERROR: syntax error at or near "\" at position: 1

pengu1nnn
  • 19
  • 1
  • 8
  • `\copy` is a `psql` meta-command, not a SQL command. So you can **only** use it in `psql` –  Jun 22 '20 at 08:42

2 Answers2

0

\copy is not a SQL command but a psql command: you need to use psql.

pifor
  • 7,419
  • 2
  • 8
  • 16
0

The options are in:

  1. Use psql command line utility, you will need to install it on the machine where JMeter lives and call it using OS Process Sampler
  2. Use CopyManager class from the JSR223 Sampler, you can find sample code i.e. here, in this case you will need to have Postgres JDBC driver under JMeter Classpath
Dmitri T
  • 159,985
  • 5
  • 83
  • 133