Sunday, 12 October 2014

Scripting for ODBC Protocol in LOADRUNNER

Developing scripts for a Client Server Application with SQL Server as Database. The protocol license the Client has license for MS SQL SERVER Protocol.

1. Installed application on Machine A. installed SQL Profiler on Machine B (DB server)


2. Started the SQL Profiler:
Program files> Microsoft SQLSERVER 2005>SQL Profiler>;OpenSQL Profiler>File>New Trace>connect to the DB server

3. Trace Properties window appears:
Genraltab>Enter Trace Name: xxx>Use Template: TSQL_REPLAY>Savetofile:givefilename
Events Selection Tab>click column filters>Inedit Filterwindow-SelectHosttName-Like: (Hostname of the Machine on which the applications hosted) > click OK > Then Click RUN.

4. Perform the User actions on Machine A. They are recorded in Machine B(DB Server). on which the tracing is enabled.

5. Select each Trace file and convert into T-SQL scripts. How? see belowgoto file( in SQL Profiler)>Export>Extract SQL Server Events>Extract transact SQL Events> save them

6. Then copy the content of the T-SQL file to a precreated Loadruner script in ODBC Protocol.
Example of the skeleton of ODBC Loadrunner Script will be given below.

7. If you execute the script it will not work.

8. To execute the script, setup ODBC connection in the machine on which the script is being executed. HOW? See Below
Go to control Panel> Administrative tools>click DataSource ODBC> Add SELECT: SQL Native client
NAME/Description and server: Enter the Server Name> Enter :UserName/Password.

9. Now the ODBC Script is ready to be executed

10. Convert MSSQL Loadrunner script to ODBC Script other wise it will not run in controller due to the license issue.

Skeleton of ODBC Script:

lrc_open_context

lrd_alloc_connection

lrd_openconnections

lrd_open_cursor

lrc_stmt

lrd_exec

The content of the Trc file goes here:

lrd_close_cursor

lrd_close_connections

lrd_free_connection

lrc_close_context

No comments:

Post a Comment