jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oliver lloyd <oliver_ll...@hotmail.com>
Subject Re: Feeding a JDBC sampler with multiple SQL statements from a SQL script file
Date Sat, 07 Apr 2012 09:24:12 GMT
One thing, have you tried with ${SQLStmt} - ${} is the notation for how JM refers to variables.

Apart from that, as it stands this should work. Try moving the View Results Tree Listener
from where it is as a child of the JDBC request to the top of the testplan, that way you will
see results for everything. Then add a Debug Request, that will show more information.

On 7 Apr 2012, at 09:59, Wolfgang Wyremba wrote:

> 
> hello,
> 
> let my outline my current configuration below...
> 
>>> So, is there a way to "feed" a JDBC sampler with an external file, holding different
SQL statements?
>> 
> Yes, you can pass a variable directly into the SQL statement itself. 
> Eg. In the Query edit box, you might have something like:
>> 
>> INSERT INTO `myDB`.`emails` (`email`) VALUES ('${myEmail}');
>> 
>> Where ${myEmail} is a jmeter variable.
>> 
>>> 
>>> I could find one posting in this mailling list, discussing this issue using CSV
data set configs:
>>> http://jmeter.512774.n5.nabble.com/How-to-run-SQL-log-against-database-td525660.html
>>> 
>>> However, I am not sure, whether this is the right solution and additionally I
could not manage to get it working.
>> 
>> 
> Sounds like a good solution to me, there may be others, but this would 
> certainly work and actually, probably isn't all that hard. You just ahve
> to get the CSV Dataset Config to work. 
>> 
>> What exactly is it that is causing you trouble?
> 
> I have a working JDBC configuration and I can run a single SQL statement without any
problems in a JDBC sampler.
> 
> I set up a text-file called "JMeterCSVSQL.txt" which has two SQL statements - each in
a line seperated with a semicolon:
> SELECT * FROM DBC.TablesV ORDER BY 1;
> SELECT * FROM DBC.TablesV ORDER BY 1, 2, 3;
> 
> My CSV data set config has the following settings:
> - filename: C:\JMeterCSVSQL.txt
> - character set: UTF-8
> - variable name: SQLStmt
> - delimiter: ;
> 
> I did not touch the other settings.
> 
> My JDBC sampler has the following settings:
> - Variable Name Bound To Pool: DB1 ... this is my working DB-connection
> - Query-Type: SELECT statement
> - Query: {SQLStmt}
> 
> I did not touch the other settings.
> 
> Well, this configuration does not work.
> I always get the following JDBC Error: 
> <sample t="33" lt="33" ts="1333788631220" s="false" lb="JDBC Request" rc="HY000 1074"
rm="com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata JDBC Driver] [TeraJDBC 13.10.00.29]
[Error 1074] [SQLState HY000] Invalid Escape Clause &quot;{SQLStmt}&quot;" tn="TG_Queries
1-1" dt="text" by="0"/>
> 
> I
> also tried to change the query to '{SQLStmt}' but that didn't work as well.
> The JDBC error then is:
> <sample t="35" lt="33" ts="1333788770333" s="false" lb="JDBC Request" rc="42000 3706"
rm="com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata Database] [TeraJDBC 13.10.00.29]
[Error 3706] [SQLState 42000] Syntax error: expected something between the beginning of the
request and the string &apos;{&apos;." tn="TG_Queries 1-1" dt="text" by="0"/>
> 
> 
> My layout of my JMeter file is:
> Thread Group
>     JDBC Connection
>     CSV Data Set Config
>     JDBC Request
>         View Result Set in Table
>     Summary Report
> 
> 
> So, there seem to be some small changes needed; but I am not sure what I have to change
to get it working.
> 
> I hope you can give me some more hints on how to solve this issue.
> 
> Thanks.
> 
> 		 	   		  


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Mime
View raw message