Execute SQL from a standard WEB vuser (1555 Views)
Trusted Contributor
Posts: 218
Registered: ‎03-12-2009
Message 1 of 4 (1,555 Views)
Accepted Solution

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.

Posts: 88
Registered: ‎08-06-2008
Message 2 of 4 (1,541 Views)

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
Posts: 142
Registered: ‎10-27-2011
Message 3 of 4 (1,517 Views)

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
Posts: 1
Registered: ‎12-16-2012
Message 4 of 4 (1,404 Views)

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


The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.