Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JMeter: Inserting record into database by using JDBC request

Tags:

jmeter

I have configured JDBC connection in my JMeter test plan. The database settings in JDBC connection are configured correctly. I am extracting employee id from one of my requests response.(i.e Employee_Id) By using BSF PostProcessor, i have stored the employee id into a variable called as Emp_ID I want to insert the extracted employee id into my database.

Database used is Oracle SQL developer, Version 4.0.1.14,Build MAIN-14.48. Table name is : Employee_Details Column name is : Employee_id ,Datatype: VARCHAR2

In JDBC request,i have selected "Query Type" as "Update Statement" and entered the following query:

Query 1: INSERT INTO Employee_Details (Employee_id) 
         VALUES (${Emp_ID})

Query 2: INSERT Employee_id='${Emp_ID}'

Parameter Types is given as VARCHAR2.

On both the execution, JMeter displays error as "Cannot create PoolableConnectionFactory (ORA-00923: FROM keyword not found where expected)"

Please provide your valuable suggestion on this.

like image 315
Vishal Avatar asked Oct 15 '25 18:10

Vishal


2 Answers

I found a workaround for this that avoids having problems:

JDBC Request Query Type needs to be: Update Statement The query needs to be processed as a block

BEGIN

SQL Statement

END;
like image 87
Man Ionut Avatar answered Oct 19 '25 07:10

Man Ionut


My expectation is that you have incorrect validation query:

JDBC Validation Query

If you left the "Validation Query" box value default - Select 1 - Oracle may not like it very much. You need to change it to select 1 from dual

References:

  • DBCP - validationQuery for different Databases
  • The Real Secret to Building a Database Test Plan With JMeter
  • ORA-00923: FROM keyword not found where expected tips
like image 44
Dmitri T Avatar answered Oct 19 '25 07:10

Dmitri T