How-to retrieve parameter data from MySQL database

Posted: April 21st, 2008 | Author: TnT Admin | Filed under: How-Tos | Tags: , | 7 Comments »

As you’ve know, LoadRunner offers the feature of retrieving parameter data from database with the Database Query Wizard in Vugen. This allows ease and alternative preparation of your parameter data for load test. By putting a little creativity on this feature, we need not limit ourselves to the example of Microsoft Access database as mentioned in it’s Vugen User Guide, we can extend this feature to other types of database, say, MySQL database!

Let’s go through a technical overview of what you need to do for it to work!

  1. Get and install the database driver to connect to the database
  2. Get the database connection string
  3. Get the SQL statement for query
  4. Create a new parameter using Database Query Wizard
  5. Enter the connection string and the SQL statement

Now, let’s go through the details here with some screenshots to make it easier to understand.

[1] Download driver

I’ve obtained my MySQL-ODBC driver from MySQL website. You will need to find out what is the driver required to connect your database accordingly.

[2] Get the database connection string

In the context of MySQL database, I referred to ConnectionStrings. The string that I used was for 3.51 driver and I was trying out on a localhost MySQL which will looked like the below

Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=myDatabase; User=root;Password=rootpassword;Option=3;

Of course, you can refer to other type of connection string in ConnectionStrings.com as well! If you have tried out with other database, please let us know and we can compile them into a single source of reference point!

[3] Get the SQL statement

The SQL statement that I used was show status, which actually queries the status of MySQL database. Take note, I’m just using it for example purposes, you can use conventional statements like SELECT field FROM table.

[4] Create a new parameter using Database Query Wizard

In the script and create a new parameter using Database Query Wizard (Open Parameter list > New > Data Wizard > Select “Specify SQL statement manually” > click “Next”)

Database Query Wizard

[5] Enter the Connection String and SQL statement

Enter the Connection String and SQL statement, and click “Finish”. If the connection string and SQL statement are valid, after you clicked “Finish” the parameter should be populated accordingly.

Enter Connection String and SQL statement

Connection and query successful!

That’s it and done! Hope it helps you when you are using the Database Query Wizard! Do share with us if you have tried other databases with the Database Query Wizard!

Related Posts


7 Comments on “How-to retrieve parameter data from MySQL database”

  1. 1 Gentry said at 12:49 am on November 11th, 2008:

    We are getting an Error that sayes… Data Retriever failed to execute query. Does anyone know why?

  2. 2 TnT Admin said at 8:31 pm on November 12th, 2008:

    What was the query you issued? Is it a valid query?

  3. 3 Joseph said at 12:02 pm on November 15th, 2008:

    I followed the steps mentioned above got the error “Data Retriever failed to execute query”

  4. 4 TnT Admin said at 12:38 pm on November 20th, 2008:

    What was the query you issued? Is it a valid query? Did you changed the server, username and password parameters?

  5. 5 LoadTestGuy said at 3:36 pm on January 19th, 2009:

    I am able to retrieve data using the Data Retriever.for my scenario if i use a particular data for 1 iteration.i will not be able to use the same data again.so when i run the same scenario again should i configure the data wizard again..the problem is i use more than one parameter and if i need to configure it again its going to take time..any ideas on this ?

  6. 6 TnT Admin said at 11:02 pm on February 21st, 2009:

    Hi LoadTestGuy, You might want to consider looking at the test management angle, such as preparing the image of the database that you draw data from or prepare additional data?

  7. 7 Deepakgu said at 7:14 pm on March 21st, 2009:

    Hi,
    There is one situation where say the sql query result can be different after each iteration of script. Here I face 2 problems.
    1. If there are two parameters each having individual query and the second parameter data will be dependent on the first query then how two execute this scenario. (Because the data will take the values from the preexisting .dat file at the time of script creation).
    2. If I need to pass a co-related value (from web_reg_save_param function), can i get some way where I can pass this value in script (can I pass a parameterized query?).

    Thanks,
    Deepakgu


Leave a Reply