Re: lr_db_executeSQLStatement returns access violation (1268 Views)
Reply
Trusted Contributor
Percy Bell
Posts: 348
Registered: ‎09-18-2008
Message 1 of 11 (1,326 Views)
Accepted Solution

lr_db_executeSQLStatement returns access violation

When running the following statement against an Oracle DB:

 

        lr_db_executeSQLStatement("StepName=Find Order",
            "ConnectionName=ORDER",
            "SQLStatement=select * from btl_event where event_id = 103",
            "DatasetName=OrderEvents",
            LAST);

 

I get the following error:

 

Error: SQL Statement failed {"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."}

 

This SQL is valid when executing it in PL/SQL.  What is wrong here?

HP Expert
Shlomi Nissim
Posts: 106
Registered: ‎08-15-2009
Message 2 of 11 (1,321 Views)

Re: lr_db_executeSQLStatement returns access violation

From which protocol did you try using it? As far as I remember this function was made availabile only for Web Services protocol, maybe this is the issue

Visit LoadRunner Linked-In Group: http://www.linkedin.com/groups?about=&gid=1879289

Visit TruClient Linked-In Group: http://www.linkedin.com/groups/HP-TruClient-Software-group-4539324/about
Trusted Contributor
Percy Bell
Posts: 348
Registered: ‎09-18-2008
Message 3 of 11 (1,316 Views)

Re: lr_db_executeSQLStatement returns access violation

I am using the WebService protocol.  I can execute other queries successfully so I know it "can" work.  Just doesn't work in this simple case.  I don't want to write a complicated query if this simple one doesn't work.

HP Expert
Shlomi Nissim
Posts: 106
Registered: ‎08-15-2009
Message 4 of 11 (1,307 Views)

Re: lr_db_executeSQLStatement returns access violation

  1. You mention that other queries were executed successfully. Can you share an example?
  2. Can you share a larger snippet of the script? Maybe the failure is related to some other issue that is impossible to trace just by seeing this statement

 BTW: HP released a product called Service Test. It provides much broader set of capabilities around database interaction and its’ Vuser/script can run in LoadRunner as part of the scenario. I suggest you read more about it by checking http://www.hp.com/go/servicetest

Visit LoadRunner Linked-In Group: http://www.linkedin.com/groups?about=&gid=1879289

Visit TruClient Linked-In Group: http://www.linkedin.com/groups/HP-TruClient-Software-group-4539324/about
Trusted Contributor
Percy Bell
Posts: 348
Registered: ‎09-18-2008
Message 5 of 11 (1,305 Views)

Re: lr_db_executeSQLStatement returns access violation

[ Edited ]

Running just this causes the exception.   I moved this code tot he vuser_init to remove the rest of my script for potientially causing an issue.

 

  lr_db_connect("StepName=Connect to DB",
   "ConnectionName=DB",
   "ConnectionString=Provider=OraOLEDB.Oracle.1;Data Source={DB_Source};Password={DB_Password};User ID={DB_Username}",
   "ConnectionType=OLEDB",
   LAST);

 

  lr_db_executeSQLStatement("StepName=Find Order",
   "ConnectionName=DB",
   "SQLStatement=select * from event where event_id = 103",
   "DatasetName=OrderEvents",
   LAST);

 

 

 

Believe it or not running this more complicated query works:

 

"SQLStatement=SELECT e.event_id, e.event_result,"
           " to_char(e.event_start, 'MM-DD-YYYY HH24:MI:SS') AS \"EVENT_START\","
           " to_char(e.event_end, 'MM-DD-YYYY HH24:MI:SS') AS \"EVENT_END\","
           " ERROR_MESSAGE from event e"
           " JOIN event_order o"
           " ON e.event_id = o.event_id"
           " WHERE e.event_result IS NOT NULL AND o.order_number = '{OrderNumber}'"

HP Expert
Shlomi Nissim
Posts: 106
Registered: ‎08-15-2009
Message 6 of 11 (1,299 Views)

Re: lr_db_executeSQLStatement returns access violation

I believe you should open a ticket to HP Support team. It looks very strange that this query isn't runing.

 

Just out of curiosity, can you run the same query but not askinf for all fields, just one/some of them? e.g.: select event_id,event_result from event where event_id = 103

 

maybe the asterisk causes an issue

Visit LoadRunner Linked-In Group: http://www.linkedin.com/groups?about=&gid=1879289

Visit TruClient Linked-In Group: http://www.linkedin.com/groups/HP-TruClient-Software-group-4539324/about
Trusted Contributor
Percy Bell
Posts: 348
Registered: ‎09-18-2008
Message 7 of 11 (1,297 Views)

Re: lr_db_executeSQLStatement returns access violation

I actually do have one open.  I opened it on Oct 26th.  Still waiting for an answer. :(

Trusted Contributor
Percy Bell
Posts: 348
Registered: ‎09-18-2008
Message 8 of 11 (1,292 Views)

Re: lr_db_executeSQLStatement returns access violation

Thanks Shlomi!  The asterisk is what did it!  After placing the column names in the query it started to work!  It's funny that the LR documenation for this method doesn't list that as a limitation. 

 

Thanks for your help.  I gave you a Kudos!

HP Expert
Shlomi Nissim
Posts: 106
Registered: ‎08-15-2009
Message 9 of 11 (1,290 Views)

Re: lr_db_executeSQLStatement returns access violation

I will make sure it is documented for the next version.

 

Happy to see this is behind us :-)

Visit LoadRunner Linked-In Group: http://www.linkedin.com/groups?about=&gid=1879289

Visit TruClient Linked-In Group: http://www.linkedin.com/groups/HP-TruClient-Software-group-4539324/about
HP Expert
Shane_Evans
Posts: 153
Registered: ‎04-08-2010
Message 10 of 11 (1,271 Views)

Re: lr_db_executeSQLStatement returns access violation

Just curious, but do we know if this is a limitation of the function in Vugen, or could it be that the Oracle database that the statement was being executed against is configured to not allow wild card queries? I seem to recall using a wild card in this function in the past, unless it has changed since version 9.1.

Cheers,

Shane Evans
Product Manager - HP LoadRunner
www.hp.com/go/loadrunner
Trusted Contributor
Percy Bell
Posts: 348
Registered: ‎09-18-2008
Message 11 of 11 (1,268 Views)

Re: lr_db_executeSQLStatement returns access violation

After reporting these findings to HP support,  support came back and said against the MS SQL server they were testing against,  a wild card query worked.  So the function may support it.  I will say that running the same query against PL/SQL with the wildcard works as well.  Unless the DB is setup so OLEDB calls cannot be wildcard,  it is setup to accept wildcard queries.

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.