Highlighted
Respected Contributor.
Respected Contributor.
1515 views

How to useVugen 12.50 to connect to a mainframe DB2 database

I am trying to connect to a DB2 database but the following command in Vugen is failing:

lr_db_connect("StepName=Connect",
"ConnectionName=DB2",
"ConnectionString=Driver={IBM ODBC DB2 DRIVER};Database=SYSIBM;Hostname=mvs2.XXXX..us;Port=XXXX;Protocol=TCPIP;Uid=userid;Pwd=password;",
"ConnectionType=ODBC",
LAST);


The error I get is given below:

Virtual User Script started at : 9/16/2016 3:51:02 PM
Starting action vuser_init.
vuser_init.c(9): DB Connection "Connect" started ... Wait ....
vuser_init.c(9): DB Connection failed {"ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"}
vuser_init.c(9): Error (-17944): DB Connection failed {"Connect"}
Abort was called from an action.

The Loadrunner 12.5 Function reference help document suggests to use the mouse to click on: Design >
Insert in Script > New Step. When the Steps Toolbox panel appears select the lr_db_connect function and a Connection wizard is supposed to appear.

However, the lr_db_connect function is NOT LISTED, so no Connection Wizard windows appears. Why? Is the 12.5 function reference incorrect? Why is the commonly used, lr_db_connect command not listed in the Steps Toolbox?

is there another way to start the Connection Wizard for the DB2 database connection?

How do you let Vugen know the connection parameters for your DB2 database? The general information provided in the help documentation is insufficient in order to determine what is needed. I have other database tools that use an ODBC connection to DB2 and those tools work fine. However, Vugen does NOT know of the configuration details contained within the configuration settings for those other database tools.


What I really need is some examples showing the full lr_db_connect command needed for  connecting to a IBM DB2 mainframe database using an ODBC connection. I just need the correct Connection string syntax (with all the REQUIRED parameters) and the documentation that describes where to get or how to define the values for those REQUIRED parameters. For example, I know the hostname, the port to use for the connection, the database name, the protocol (TCPIP), the userid and the password. However, I do not know how to tell Vugen 1) what IBM ODBC Driver to use and 2) where the software of this driver is located on my WIndows system.

I was reading some community post that stated that they fixed this problem using a DSN name. If that is true, then where do you specify this DSN name and what is the proper syntax within the lr_db_connect command to do this?

0 Likes
3 Replies
Highlighted
Respected Contributor.
Respected Contributor.

Re: How to useVugen 12.50 to connect to a mainframe DB2 database

Hello rdachows.

I will suggest you to connect to DB2 first using the next method, if you are able to pull some information then you will be able to do in using command line. I have included a bounch of screenshots to guide you in the process.

  1. Go to Parameter List
  2. Create a new parameter and select Parameter Type as "TABLE"
  3. Click Data Wizard... option (Besides to Edit with Notepad)
  4. In the Database Query Wizard select "Specify SQL statement Manually"
  5. In the next screen, select "CREATE" option without entering nothing manually at this point.
  6. The list that shows up, go to the Tab names "Machine Data Source" these are the Data Source list you have in your ODBC connections, (if you do not have in your ODBC this data you won't never be able to connect to DB2 using VuGen or Excel macros or other windows tools besides Toad or Data Studio or some other Database interfaces)'. 
  7. Select the Data source you want to connect and click OK (If you don't have it, I recommend you to create it using ODBC windows tool, not VuGen.
  8. The data string will appear in the Database Query wizard. Don't modify it, it needs to match with wherever information was pulled from Windows Data Sources. If the information is wrong go to the ODBC and configure a proper Data Source.
  9. In the SQL statement, write your query, try with a simple select query with few columns and without a lot of conditions, that way you can at least see if you are able to connect. Use the Schema name before the table and column names. and Click OK
  10. The parameter file will be created with the information the query was able to pull from the DB2

If you were able to reach this point, then you are ready to use this with VuGen commands. But if you were not able to, then go to the ODBC connections and test your connections from there until you are able to connect to the database and set up your ODBC correctly, then you can try again in VuGen.

The steps I shows above are static data, once you do it once, the file remains static, is just one-time connectivity and then the data remains the same even when it changed at the database level, if you want to update the information always, then the command line in VuGen is the way to go.

Using command line, it saved me tons of work and time to update the parameter content each time there is a database refresh or so.

I hope this helps, if you need more help with VuGen commands to connect to the DB2 please let me know.

Regards.

Josue Chavez

Josue A. Chavez D.
Highlighted
New Member.

Re: How to useVugen 12.50 to connect to a mainframe DB2 database

Hi,

Was this issue resolved? I am trying to connect to DB2 from vugen and I am using

lr_db_connect("StepName=teststep",
"ConnectionName=DB2DSNQ",
"ConnectionString=Driver={IBM DB2 ODBC DRIVER};Database=DB2DSNQ;Hostname=*******com;Port=*****; Protocol=TCPIP;Uid=*******;Pwd=*******;",
"ConnectionType=ODBC",
LAST);

I am getting the error c/program files/ analysis/dat/db_connection.xsl file not found error when i run the script

I have ODBC drivers installed on my PC and i tried to connect to DB via databasse query wizard as well.However i got the below error

data retriever failed to execute query vugen 

I need to do insert/ update/delete operations on DB2 via loadrunner.

 

0 Likes
Highlighted
New Member.

Re: How to useVugen 12.50 to connect to a mainframe DB2 database

In order to connect you have to configure ODBC connecion on windows (I used 32 bits driver, 64 didnt work).

Test your ODBD definition and after you get the correct conection message you can configure the connection in loadrunner.

Write the odbc driver name defined in the windows odbc connection to use it 

I used the following connection string, just replase xxxxx with your database information.

         lr_db_connect("StepName=Conn",
        "ConnectionName=Conn",
        "ConnectionString=Driver={IBM DB2 ODBC DRIVER - C_IBMDB2_CLIDRIVER32};Hostname=xxx.xxx.xxx.xxx;Port=xxxx;Database=xxxxx;Protocol=TCPIP;Uid=xxxxxxxx;Pwd=xxxxxx",
        "ConnectionType=ODBC",
        LAST);

Note. download the correct odbc cli driver for your db2 version.

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.