On 6 April 2012 17:36, oliver lloyd <[email protected]> wrote: > On 6 Apr 2012, at 17:17, Wolfgang Wyremba wrote: > >> >> Hello, >> >> >> In the past, I always added a JDBC sampler for each single SQL statement - >> that worked without problems. >> >> But now I have a SQL script with dozens of SQL statements (one line per SQL >> statement always ending with a semicolon) which I want to run in JMeter. >> >> It is quite time consuming to set up JMeter with a JDBC sampler for each SQL >> statement. >> >> 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? >> >> If this is the right solution to my problem, can someone share with me how >> to connect the csv file with the JDBC sampler? >> What should be file format of the csv file and what do I have to configure >> in the csv data set config and JDBC sampler? > > See my link above, but if your file contains SQL then it's probably a good > idea to "quote" it.
Or just make sure that the delimiter is set to something that does not appear in the file. >> >> Any help is much appreciated. >> >> Thanks, >> wywo > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
