How to connect to database using Vugen/LoadRunner?

Please Like Us!!!

LoadRunner Interview Questions

Q: How to connect to DB using Vugen/LoadRunner?
A: lr_db_connect function can be used to connect to database via Vugen.

int lr_db_connect(“StepName”, “ConnectionString=connection_string”, “ConnectionName=connection_name”, “ConnectionType=connection_type”, LAST);

StepName The name of the step, as it appears in the test tree. Any text can be used.
ConnectionString A string indicating the database to which to connect and other information needed to establish the connection.
The syntax for the connection string varies depending on the data provider specified with the ConnectionType argument. For example, to connect to an SQL Server, ConnectionString could contain the value:
Data Source=myServerAddress; Initial Catalog=myDatabase Id=myUser;Password=myPassword;
Note that the equal signs are part of the connection string.
The password cannot be encrypted.
ConnectionName A logical name for the connection.
ConnectionType Type of data provider. Valid values are:
SQL (meaning, the Microsoft Native SQL Provider)
LAST This delimiter marks the end of the argument list.

“ConnectionString=Data;Initial Catalog=Database;Persist Security Info=True;User ID=User;Password=Password”,

Reviews & Comments


Be the first to comment

Leave a Reply

Your email address will not be published.