HP LoadRunner and using the ODBC driver – [MsgId: MERR-108770]

Once in a while during performance tests, I have to put load directly on a database server. Now, this doesn’t happen too often – the most popular tests in the last couple of years have been measurements on the interface seen by the end users. This means web interfaces mostly, sometimes the GUI of a rich client (hello .exe files!). Sometimes rich web interfaces (mainly Ajax frameworks like GWT) and once in a while text terminal interfaces (DEC VT200 or IBM 3270).

In an assignment a short while ago, I was in the position to measure the performance of a database server, using LoadRunner. (Another packaging of LoadRunner is PerformanceCenter; roughly one could describe Performance Center to be the enterprise version of Load Runner containing Load Runner plus a few other components.) This performance test tool knows a lot of different protocols and interfaces and one of them is to use ODBC . Luckily, just about every relational database server knows ODBC too. Good match! Of course, depending on what brand the server is, one may have to set up a data source name (DSN). To be able to add the correct DSN one might maybe install a special ODBC driver from the database manufacturer.

No problem, I did the set up on my Windows workstation, a laptop. Finding out the exact details might take a short while but isn’t too hard. After installing the right tools, including a client to connect and login to a database server and the correct schema, and being able to enter SQL statements to get some result (my favorite is SHOW TIME), it was easy to use Vugen to write a small script of protocol type ODBC.

vuser_init()
{

    int retval;

    retval = lr_db_connect("connect",
        "ConnectionString=dsn=foo.my.domain;userid=blue;password=berry",
        "ConnectionName=foodb",
        "ConnectionType=ODBC",
        LAST ); //Always returns 0, no need to inspect value of retval

    //If connect fails, an error is thrown so if we are here we have a connection

    retval = lr_db_disconnect("StepName=disconnect",
        "ConnectionName=foodb",
        LAST );

    lr_output_message("DEBUG: connect worked, disconnect %s",
        LR_PASS == retval ? "worked too" :
        LR_FAIL == retval ? "FAILED" :
        "is in unknown state");

    return 0;
}

This was a small test script to see if Vugen on my machine could connect to the database. It just connects, then disconnects and reports if it managed.

Did it work on my Windows laptop? Yes.

Did it run when run through the Controller of LoadRunner and therefore executed on a load generator machine? No.

In the test runs output I found the error messages about DB Connection failed, about data source name not found and about [MsgId: MERR-108770] (the kind of error messages LoadRunner shows). All of this was generated on said load generator.

vuser_init.c(8): DB Connection "DatabaseConnection" started ... Wait .... [MsgId: MMSG-108774]
vuser_init.c(8): Error: DB Connection failed {"ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"} [MsgId: MERR-108770]
vuser_init.c(8): Error: DB Connection failed {"DatabaseConnection"} [MsgId: MERR-108770]
vuser_init.c(8): Notify: Transaction "DatabaseConnection" ended with "Fail" status (Duration: 1.0982 Wasted Time: 1.0970). [MsgId: MMSG-16871]
Abort was called from an action. [MsgId: MMSG-10447]

Aha. OK, so I had to configure the DSN on the load generator – meaning for this particular database vendor, I had to install the ODBC driver on the load generator. That was done rather quickly. At least, quickly after getting access to log in on the load generator. Now I could run again.

Only – I got the same error again!

This time I installed the whole client from the vendor, not just the driver. The client worked as a charm on the load generator, SHOW TIME reported the correct time. Good.

But running through the Controller again, I got to see the same error again. Odd. As usual, the only path is forward so I kept chugging along. Could I use Vugen on the load generator? Yes, no problem. It could run the test script, connecting and disconnecting just fine. Both the SQL client and Vugen worked fine now. Trying it from the Controller again, I still saw the same error.

At this point, it is so good to be able to search the web to get access to good ideas. I rather quickly found a mention about credentials, about ODBC drivers being installed either for only yourself or system wide (i.e., as running either as you or as a Windows system user). Could this be the case? Well, I hadn’t manually added the ODBC driver, I had been relying on the vendors installation program for the vendors driver. Checking in Start → All Programs → Administrative Tools → Data Sources (ODBC) it was quickly clear to me what the problem was.

I found my ODBC driver in the tab User DSN while the tab System DSN was empty.

Bitten by my laziness! Doing this for the first in time in so many years, I should have known better.

The remedy? Renaming the entry in the User DSN tab to start with an extra letter (x) and adding a new entry in the System DSN tab with all the entries copied. Just to be on the safe side, I rebooted the load generator. After waiting for it to be back online, I could run the test script in a test run via the Controller.

Problem solved!

Annonser
Det här inlägget postades i LoadRunner, performance och har märkts med etiketterna . Bokmärk permalänken.

5 kommentarer till HP LoadRunner and using the ODBC driver – [MsgId: MERR-108770]

  1. Ping: Step by step instructions to download and install LoadRunner « Zeeshan Akhter

  2. Ranjith skriver:

    Hi, i am trying to connect to a database with the same script, but am gettig below error. can you please help me?

    vuser_init.c(5): DB Connection ”connect” started … Wait ….
    vuser_init.c(5): Error: DB Connection failed {”ERROR [28000] [Oracle][ODBC][Ora]ORA-01005: null password given; logon denied

    ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver’s SQLSetConnectAttr failed
    ERROR [28000] [Oracle][ODBC][Ora]ORA-01005: null password given; logon denied
    ”}
    vuser_init.c(5): Error: DB Connection failed {”connect”}
    Abort was called from an action.”

    • Klaus Zeuge skriver:

      Hello Ranjith, while in the process of debugging, of trying to causes to troubles, it is important to keep a clear mind, maybe writing thoughts, observations and ideas on a paper or in a text file and to come back to them later in case one still is stuck.
      Reviewing my code after reading the message you pasted, I don’t see how one can lead to the other. You claim you’re using the same script so I would suggest you challenge yourself about this.
      Best regards,
      Klaus

  3. LR_Test skriver:

    Writing SQL statements in vugen is explained in a simple way

    http://loadrunner95.blogspot.com/2016/10/oracle-database-load-testing.html

    • Klaus Zeuge skriver:

      Hi LR_Test and thank you for pointing to documentation which sure helps when you start out using LoadRunner to load test directly towards a database server. Hopefully, you don’t run into the same kind of problems as I did. Keep up the good work!

Kommentera

Fyll i dina uppgifter nedan eller klicka på en ikon för att logga in:

WordPress.com Logo

Du kommenterar med ditt WordPress.com-konto. Logga ut /  Ändra )

Google-foto

Du kommenterar med ditt Google-konto. Logga ut /  Ändra )

Twitter-bild

Du kommenterar med ditt Twitter-konto. Logga ut /  Ändra )

Facebook-foto

Du kommenterar med ditt Facebook-konto. Logga ut /  Ändra )

Ansluter till %s