Summary
lr_db_connect function failing during replay with error: "ORA-12154: TNS:could not resolve the connect identifier specified"
Error
While replaying the script, VuGen cannot connect to the Oracle database server using the function lr_db_connect. The following error message is received:
vuser_init.c(4): DB Connection failed {"ORA-12154: TNS:could not resolve the connect identifier specified"}
vuser_init.c(4): Error (-17940): DB Connection failed {"getAccessCode"}
Example of tnsnames.ora file on the VuGen machine:
MYSID=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = mydnshostname)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = sid01)
)
)
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = mydnshostname)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = sid01)
)
)
Using the command sqlplus on the VuGen machine is working and it is able to connect to the database.
Cause
The ADDRESSNAME and SERVICENAME (SID) defined on the VuGen machine's tnsnames.ora file are different.
Fix
Changing the ADDRESSNAME to match the SERVICENAME (SID) fixed the problem in this case. Here is the corrected tnsnames.ora file used in this example:
sid01=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = mydnshostname)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = sid01)
)
)