On 10 April 2012 09:28, Wolfgang Wyremba <[email protected]> wrote:
>
> Thanks for your help - I now have some improvements .
>
> I did the following:
> I tried ${SQLStmt} in the JDBC sampler - but that did not work because always 
> a "?" was placed in front of my SQL string.

That must have come from the CSV file - did you create it with a text
editor, or a word-processor?

> Therefore, I added a dummy-column in my SQL script file.
> The file looks now:
> dummy;SELECT * FROM dbc.tablesV ORDER BY 1
> dummy;SELECT * FROM dbc.tablesV ORDER BY 1, 2, 3
>
>
> My CSV data set config has now the following settings:
> - filename: C:\JMeterCSVSQL.txt
> - character set: UTF-8
> - variable name: dummy,SQLStmt
> - delimiter: ;

Which is fine so long as you never need to include a semi-colon in
your SQL statement.

> I do not use the dummy variable, but now I can execute one SQL statement 
> which is placed in the SQL script file.
>
> However, there is one problem again:
> Only the first SQL statement of the textfile gets executed - the others do 
> not get executed.
>
> I am not sure, why JMeter does not fetch row after row of the textfile and 
> does not execute all statement.
>
> The debugging info also did not show me any more information about that.
>
> Do you have any other hints to solve this issue?
>
> thanks
>
>
>> Subject: Re: Feeding a JDBC sampler with multiple SQL statements from a SQL 
>> script file
>> From: [email protected]
>> Date: Sat, 7 Apr 2012 10:24:12 +0100
>> To: [email protected]
>>
>> 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: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to