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

1
  • \copy is a psql meta-command, not a SQL command. So you can only use it in psql Commented Jun 22, 2020 at 8:42

2 Answers 2

0

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

Sign up to request clarification or add additional context in comments.

2 Comments

Hi @pifor any other query idea to insert csv file to PostgreSQL table using sql from JMeter
Sorry but I cannot help with JMeter.
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

2 Comments

U mean i need to execute JSR223 Sampler code using OS Process Sampler.
These are 2 different approaches

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.