LoadRunner Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

Execute SQL from a standard WEB vuser

Go to Solution
Trusted Contributor [Founder]

Execute SQL from a standard WEB vuser

So yes, LR has custom functions for making connections to a database and running queries and I know there is a suite of database specific vuser types, but I am looking for a solution that allows me to run SQL that can be plugged into a standard web type vuser. I'm sure it's possible; I'm looking for the most elegant way.


Basically I want to be able to establish a connection (to Oracle 10g), run some simple SQL, and then parse the results.


This is initially for a specific requirement to track the session count but I can straight away see all sorts of benefits to being able to do this.


I can also think of some possible solutions, like:


Calling out to the command line and doing something there

Running a shell script (via the command line)

Setting up a simple web interface to execute SQL and screen scraping that


But this seemed like something that has probably been done many times before so worth a post.


Re: Execute SQL from a standard WEB vuser

Actually - you can manually record the SQL calls with an Oracle 2-Tier virtual user - from behind a sql*plus session...to execute the query and record the calls into that virtual user.


Then you can manually merge that script with your web virtual user script.


It can be done - I did a presentation back in 1999 on exactly doing this with Web & ODBC.


You could also do this with an external program, if that works better for you.



Mark Tomlinson
Performance Testing and Engineering Guru
Regular Advisor

Re: Execute SQL from a standard WEB vuser

I am too looking to see if I can run SQL queries from the HTTP/Click and Script protocols but I would be querying SQL Server.   I worked at a previous company where a developer had a Loadrunner script that loaded a dll that had C methods to connect to a database via ODBC and able to do queries.  I don't know if he created that dll or if he found it somewhere online(the developer was no longer at the company when I came in).   Do you all know of such a dll out there?


Occasional Visitor

Re: Execute SQL from a standard WEB vuser

Hi Oliver,


     I run few Performance Tests in my Org and I have a specific requirement where I have to run a simple SQL query in HTTP/HTMl LR script, the SQL query I wanted to run is just an update query on a simple table.


Kindly request you to provide me a script or procedure which I can use to do this, since your question here is also based on the same, kindly let me know if you found a solution and were you able to run the SQL query from LR script


With Best Regards


Occasional Advisor

Re: Execute SQL from a standard WEB vuser

I require some assistance.

We have a requirement to perform SQL queires in LR, against ODBC. 

The problem I am facing is that we are only licenced to WEB 2.0 protocols, and the application under test is a Client facing UI, so not accessible via Web.

Any suggestions on how this can be done?

Occasional Advisor

Re: Execute SQL from a standard WEB vuser

Writing SQL statements in vugen is explained in a simple way