Highlighted
Visitor.
1373 views

LoadRunner 12.53 / Oracle Database 12c (Oracle - 2 Tier) struggling with statement execution

Jump to solution

Hi,

I'm trying to write a basic script that will output some DB Data (for now).

I've recorded the script with Oracle 2 Tier and SQLPlus Login and Logut works fine but the execution of a statement is not working.  I'm getting following Error:

Action.c(11): server_detach: ServerHandle=OraSrv1 
Action.c(12): server_attach: ServerHandle=OraSrv1, ServerID="removed" 
Action.c(13): attr_set: TargetHandle=OraSvc1, SERVER=removed
Action.c(14): attr_set: TargetHandle=OraSes1, USERNAME="removed" 
Action.c(15): attr_set: TargetHandle=OraSes1, PASSWORD="[Hidden]" 
Action.c(16): attr_set: TargetHandle=OraSvc1, SESSION=OraSes1 
Action.c(17): session_begin: SvcCtxHandle=OraSvc1, SessionHandle=OraSes1 
Action.c(20): lrd_ora8_stmt: StmtHandle=OraStm7, Text="SELECT * FROM ALL_TABLES" 
Action.c(22): attr_set: TargetHandle=OraStm7, PREFETCH_ROWS=1 
Action.c(23): ora8_exec: 0 row(s) processed 
Action.c(26): Error: lrdo_ora8_fetch: "OCIStmtFetch" return-code=OCI_ERROR, error-code=24374:
Action.c(26): Error:     ORA-24374: define not done before fetch or execute and fetch
Action.c(26): lrd_ora8_fetch: ERROR, return-code=LRDE2009.  StmtHandle=OraStm7, 0 row(s) fetched

 and my Code:

Action()
{
	lrd_init(&InitInfo, DBTypeVersion);
	lrd_initialize_db(LRD_DBTYPE_ORACLE, 6, 0);
	lrd_env_init(LRD_DBTYPE_ORACLE, &OraEnv1, 0, 0);
	lrd_ora8_handle_alloc(OraEnv1, SERVER, &OraSrv1, 0);
	lrd_ora8_handle_alloc(OraEnv1, SVCCTX, &OraSvc1, 0);
	lrd_ora8_handle_alloc(OraEnv1, SESSION, &OraSes1, 0);
	lrd_ora8_handle_alloc(OraEnv1, SESSION, &OraSes2, 0);
	lrd_server_detach(OraSrv1, 0, 0);
	lrd_server_attach(OraSrv1, "HOST:1521/SERVICE", 41, 0, 0); 
	lrd_ora8_attr_set_from_handle(OraSvc1, SERVER, OraSrv1, 0, 0);
	lrd_ora8_attr_set(OraSes1, USERNAME, "removed", -1, 0); 
	lrd_ora8_attr_set(OraSes1, PASSWORD, lr_decrypt("encryptedPassword"), -1, 0); 
	lrd_ora8_attr_set_from_handle(OraSvc1, SESSION, OraSes1, 0, 0);
	lrd_session_begin(OraSvc1, OraSes1, 1, 0, 0);
	
	lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm7, 0);
	lrd_ora8_stmt(OraStm7,"SELECT * FROM ALL_TABLES", 1, 0, 0);
	lrd_ora8_attr_set(OraStm7, PREFETCH_ROWS, "1", -1, 0);
	lrd_ora8_exec(OraSvc1, OraStm7, 0, 0, &uliRowsProcessed, 0, 0, 0, 0, 0);
	lrd_ora8_handle_alloc(OraEnv1, LOB, &OraLob1, 0);
	lrd_ora8_handle_alloc(OraEnv1, LOB, &OraLob2, 0);
	lrd_ora8_fetch(OraStm7, -1, 0, &uliFetchedRows, 0, 2, 0, 0);
	lrd_handle_free(&OraLob1, 0);
	lrd_handle_free(&OraLob2, 0);
	lrd_handle_free(&OraStm7, 0);
	
	lrd_session_end(OraSvc1, OraSes1, 0, 0);
	lrd_server_detach(OraSrv1, 0, 0);
	lrd_handle_free(&OraEnv1, 0);
	return 0;
}

Any Ideas?

Cheers Hans

0 Likes
1 Solution

Accepted Solutions
Highlighted
Visitor.

Re: LoadRunner 12.53 / Oracle Database 12c (Oracle - 2 Tier) struggling with statement execution

Jump to solution

Hi,

found the problem, missing bind variables in my code. If someone needs a small working example:

vdf.h

/* vdf.h */
#ifndef VDF_H
#define  VDF_H

#define LRD_RECORDED_UNDER_WIN32
#include "lrd.h"

static LRD_INIT_INFO InitInfo = {LRD_INIT_INFO_EYECAT};
static LRD_DEFAULT_DB_VERSION DBTypeVersion[] =
{
    {LRD_DBTYPE_NONE, LRD_DBVERSION_NONE}
};
static unsigned long        uliRowsProcessed;
static unsigned long        uliFetchedRows;
static void FAR *           OraEnv1;
static void FAR *           OraSvc1;
static void FAR *           OraStm1;
static void FAR *           OraSrv1;
static void FAR *           OraSes1;
static LRD_VAR_DESC		    USERNAME_D1={LRD_VAR_DESC_EYECAT, 1, 102, LRD_DBTYPE_ORACLE, {0, 0, 0}, DT_SZ};
static LRD_VAR_DESC		    USERID_D1={LRD_VAR_DESC_EYECAT, 1, 102, LRD_DBTYPE_ORACLE, {0, 0, 0}, DT_SZ};
static LRD_VAR_DESC		    CREATED_D1={LRD_VAR_DESC_EYECAT, 1, 102, LRD_DBTYPE_ORACLE, {0, 0, 0}, DT_SZ};
static LRD_VAR_DESC		    COMMON_D1={LRD_VAR_DESC_EYECAT, 1, 102, LRD_DBTYPE_ORACLE, {0, 0, 0}, DT_SZ};
static LRD_VAR_DESC		    ORACLEMAINTAINED_D1={LRD_VAR_DESC_EYECAT, 1, 102, LRD_DBTYPE_ORACLE, {0, 0, 0}, DT_SZ};
void  FAR  * FAR  			OraDef1;
void  FAR  * FAR  			OraDef2;
void  FAR  * FAR  			OraDef3;
void  FAR  * FAR  			OraDef4;
void  FAR  * FAR  			OraDef5;
#endif

Action.c

Action()
{
	lrd_init(&InitInfo, DBTypeVersion);
	lrd_initialize_db(LRD_DBTYPE_ORACLE, 6, 0);
	lrd_env_init(LRD_DBTYPE_ORACLE, &OraEnv1, 0, 0);
	lrd_ora8_handle_alloc(OraEnv1, SERVER, &OraSrv1, 0);
	lrd_ora8_handle_alloc(OraEnv1, SVCCTX, &OraSvc1, 0);
	lrd_ora8_handle_alloc(OraEnv1, SESSION, &OraSes1, 0);
	lrd_server_attach(OraSrv1, "removed:1521/removed", 41, 0, 0);
	lrd_ora8_attr_set_from_handle(OraSvc1, SERVER, OraSrv1, 0, 0);
	lrd_ora8_attr_set(OraSes1, USERNAME, "removed", -1, 0);
	lrd_ora8_attr_set(OraSes1, PASSWORD, lr_decrypt("removed"), -1, 0);
	lrd_ora8_attr_set_from_handle(OraSvc1, SESSION, OraSes1, 0, 0);
	lrd_session_begin(OraSvc1, OraSes1, 1, 0, 0);
	lr_think_time(2);
	lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm1, 0);

	lrd_ora8_stmt(OraStm1,"select username,user_id,created,common,oracle_maintained from all_users", 1, 0, 0);

	lrd_ora8_bind_col(OraStm1, &OraDef1, 1, &USERNAME_D1, 0, 0); 
	lrd_ora8_bind_col(OraStm1, &OraDef2, 2, &USERID_D1, 0, 0); 
	lrd_ora8_bind_col(OraStm1, &OraDef3, 3, &CREATED_D1, 0, 0); 
	lrd_ora8_bind_col(OraStm1, &OraDef4, 4, &COMMON_D1, 0, 0); 
	lrd_ora8_bind_col(OraStm1, &OraDef5, 5, &ORACLEMAINTAINED_D1, 0, 0); 

	lrd_ora8_exec(OraSvc1, OraStm1, 0, 0, &uliRowsProcessed, 0, 0, 0, 0, 0);
	lrd_ora8_fetch(OraStm1, -1, 0, &uliFetchedRows, PrintRow, 2, 0, 0);
	
	lr_think_time(2);
	lrd_handle_free(&OraStm1, 0);
	lr_think_time(2);
	lrd_session_end(OraSvc1, OraSes1, 0, 0);
	lr_think_time(5);
	lrd_server_detach(OraSrv1, 0, 0);
	lr_think_time(2);
	lrd_handle_free(&OraEnv1, 0);
	return 0;
}

print.inl (should be auto generated but wasn't in my case)

#ifndef INL_H
#define  INL_H
#ifndef CCI
BEGIN_VUSER_DECLARATION
    DECLARE_VUSER_RUN("Vuser Run", Actions)
END_VUSER_DECLARATION
#endif
LRD_ORA8_PRINT_ROW_PROTO(PrintRow)
{
    LRDRET gjLRDRet = LRDRET_I_OK;
    char captureValue[256];

	lrd_to_printable(&USERNAME_D1, muliRowIndex, captureValue, 256, "");
	lr_output_message("USERNAME_D1 is: %s", captureValue);
	lrd_to_printable(&USERID_D1, muliRowIndex, captureValue, 256, "");
	lr_output_message("USERID_D1 is: %s", captureValue);
	lrd_to_printable(&CREATED_D1, muliRowIndex, captureValue, 256, "");
	lr_output_message("CREATED_D1 is: %s", captureValue);
	lrd_to_printable(&COMMON_D1, muliRowIndex, captureValue, 256, "");
	lr_output_message("COMMON_D1 is: %s", captureValue);
	lrd_to_printable(&ORACLEMAINTAINED_D1, muliRowIndex, captureValue, 256, "");
 	lr_output_message("ORACLEMAINTAINED_D1 is: %s", captureValue);
   
   return gjLRDRet;
}
#endif

Cheers Hans

 

View solution in original post

2 Replies
Highlighted
Visitor.

Re: LoadRunner 12.53 / Oracle Database 12c (Oracle - 2 Tier) struggling with statement execution

Jump to solution

Hi,

found the problem, missing bind variables in my code. If someone needs a small working example:

vdf.h

/* vdf.h */
#ifndef VDF_H
#define  VDF_H

#define LRD_RECORDED_UNDER_WIN32
#include "lrd.h"

static LRD_INIT_INFO InitInfo = {LRD_INIT_INFO_EYECAT};
static LRD_DEFAULT_DB_VERSION DBTypeVersion[] =
{
    {LRD_DBTYPE_NONE, LRD_DBVERSION_NONE}
};
static unsigned long        uliRowsProcessed;
static unsigned long        uliFetchedRows;
static void FAR *           OraEnv1;
static void FAR *           OraSvc1;
static void FAR *           OraStm1;
static void FAR *           OraSrv1;
static void FAR *           OraSes1;
static LRD_VAR_DESC		    USERNAME_D1={LRD_VAR_DESC_EYECAT, 1, 102, LRD_DBTYPE_ORACLE, {0, 0, 0}, DT_SZ};
static LRD_VAR_DESC		    USERID_D1={LRD_VAR_DESC_EYECAT, 1, 102, LRD_DBTYPE_ORACLE, {0, 0, 0}, DT_SZ};
static LRD_VAR_DESC		    CREATED_D1={LRD_VAR_DESC_EYECAT, 1, 102, LRD_DBTYPE_ORACLE, {0, 0, 0}, DT_SZ};
static LRD_VAR_DESC		    COMMON_D1={LRD_VAR_DESC_EYECAT, 1, 102, LRD_DBTYPE_ORACLE, {0, 0, 0}, DT_SZ};
static LRD_VAR_DESC		    ORACLEMAINTAINED_D1={LRD_VAR_DESC_EYECAT, 1, 102, LRD_DBTYPE_ORACLE, {0, 0, 0}, DT_SZ};
void  FAR  * FAR  			OraDef1;
void  FAR  * FAR  			OraDef2;
void  FAR  * FAR  			OraDef3;
void  FAR  * FAR  			OraDef4;
void  FAR  * FAR  			OraDef5;
#endif

Action.c

Action()
{
	lrd_init(&InitInfo, DBTypeVersion);
	lrd_initialize_db(LRD_DBTYPE_ORACLE, 6, 0);
	lrd_env_init(LRD_DBTYPE_ORACLE, &OraEnv1, 0, 0);
	lrd_ora8_handle_alloc(OraEnv1, SERVER, &OraSrv1, 0);
	lrd_ora8_handle_alloc(OraEnv1, SVCCTX, &OraSvc1, 0);
	lrd_ora8_handle_alloc(OraEnv1, SESSION, &OraSes1, 0);
	lrd_server_attach(OraSrv1, "removed:1521/removed", 41, 0, 0);
	lrd_ora8_attr_set_from_handle(OraSvc1, SERVER, OraSrv1, 0, 0);
	lrd_ora8_attr_set(OraSes1, USERNAME, "removed", -1, 0);
	lrd_ora8_attr_set(OraSes1, PASSWORD, lr_decrypt("removed"), -1, 0);
	lrd_ora8_attr_set_from_handle(OraSvc1, SESSION, OraSes1, 0, 0);
	lrd_session_begin(OraSvc1, OraSes1, 1, 0, 0);
	lr_think_time(2);
	lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm1, 0);

	lrd_ora8_stmt(OraStm1,"select username,user_id,created,common,oracle_maintained from all_users", 1, 0, 0);

	lrd_ora8_bind_col(OraStm1, &OraDef1, 1, &USERNAME_D1, 0, 0); 
	lrd_ora8_bind_col(OraStm1, &OraDef2, 2, &USERID_D1, 0, 0); 
	lrd_ora8_bind_col(OraStm1, &OraDef3, 3, &CREATED_D1, 0, 0); 
	lrd_ora8_bind_col(OraStm1, &OraDef4, 4, &COMMON_D1, 0, 0); 
	lrd_ora8_bind_col(OraStm1, &OraDef5, 5, &ORACLEMAINTAINED_D1, 0, 0); 

	lrd_ora8_exec(OraSvc1, OraStm1, 0, 0, &uliRowsProcessed, 0, 0, 0, 0, 0);
	lrd_ora8_fetch(OraStm1, -1, 0, &uliFetchedRows, PrintRow, 2, 0, 0);
	
	lr_think_time(2);
	lrd_handle_free(&OraStm1, 0);
	lr_think_time(2);
	lrd_session_end(OraSvc1, OraSes1, 0, 0);
	lr_think_time(5);
	lrd_server_detach(OraSrv1, 0, 0);
	lr_think_time(2);
	lrd_handle_free(&OraEnv1, 0);
	return 0;
}

print.inl (should be auto generated but wasn't in my case)

#ifndef INL_H
#define  INL_H
#ifndef CCI
BEGIN_VUSER_DECLARATION
    DECLARE_VUSER_RUN("Vuser Run", Actions)
END_VUSER_DECLARATION
#endif
LRD_ORA8_PRINT_ROW_PROTO(PrintRow)
{
    LRDRET gjLRDRet = LRDRET_I_OK;
    char captureValue[256];

	lrd_to_printable(&USERNAME_D1, muliRowIndex, captureValue, 256, "");
	lr_output_message("USERNAME_D1 is: %s", captureValue);
	lrd_to_printable(&USERID_D1, muliRowIndex, captureValue, 256, "");
	lr_output_message("USERID_D1 is: %s", captureValue);
	lrd_to_printable(&CREATED_D1, muliRowIndex, captureValue, 256, "");
	lr_output_message("CREATED_D1 is: %s", captureValue);
	lrd_to_printable(&COMMON_D1, muliRowIndex, captureValue, 256, "");
	lr_output_message("COMMON_D1 is: %s", captureValue);
	lrd_to_printable(&ORACLEMAINTAINED_D1, muliRowIndex, captureValue, 256, "");
 	lr_output_message("ORACLEMAINTAINED_D1 is: %s", captureValue);
   
   return gjLRDRet;
}
#endif

Cheers Hans

 

View solution in original post

Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Re: LoadRunner 12.53 / Oracle Database 12c (Oracle - 2 Tier)

Jump to solution

I need to up this topic, because I have the same issue. 

Both v12.53 and 12.55 do not record any lrd_ora8_bind_col function and this is a pain for bigger scripts.

Does anyone have suggenstions or a solution?

 

Thanks and kind regards, 

Gaetano

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.