Rakesh133
Rakesh133

Reputation: 381

Jmeter returns 'The statement did not return a result set' for a SQL Query

I have below SQL Query which is running fine in SQL Server but its showing error while executing in JMETER

declare @LogSpace table (DatabaseName varchar(255), [Log Size (MB)] float, [Log Space Used (%)] float, [Status] int) insert into @LogSpace execute('dbcc sqlperf(''LogSpace'')')  select cast(round([Log Space Used (%)],2,0) as decimal(18,2)) from @LogSpace where DatabaseName = 'PUB_SUB_E2E';

Error: Response message: com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.

I am using the JDBC Request Query Type as 'SELECT Statement'

Any help would be appreciated.

Upvotes: 1

Views: 968

Answers (1)

Dmitri T
Dmitri T

Reputation: 168002

As per JMeter documentation:

JDBC Request

This sampler lets you send a JDBC Request (an SQL query) to a database.

In your case there are multiple queries of different nature which cannot be executed in a single shot. So the options are in:

  1. Split the statement into separate queries so only a single query would be executed by a JDBC Request sampler
  2. Convert your query into a Stored Procedure and execute it using Callable Statement
  3. Use BEGIN and END statements to specify logical blocks
  4. Move to JSR223 Sampler and write your queries in Groovy language (however you will still have to split it as suggested in the point 1 and use execute() function for parts which don't produce results and executeQuery for the parts which do.

Upvotes: 1

Related Questions