Performance Testing Oracle via JDBC with LoadRunner – Basics

Posted on May 18th 2010 by Joel Deutscher

This post discusses a method for testing Oracle via a JDBC connection, to simulate application interaction with the database. It is designed as an introduction to get you started, where you take it from there is up to you.

Understanding JDBC

The Java Database Connectivity (JDBC) API is the industry standard for database-independent connectivity between the Java programming language and a wide range of databases—SQL databases and other tabular data sources, such as spreadsheets or flat files. The JDBC API provides a call-level API for SQL-based database access.

The JDBC Thin Driver used in this method is a JDBC Type 4 driver that uses Java to connect directly to Oracle via the TNS protocol. This driver is written completely in Java and is hence platform independent and provides the best performance of all JDBC driver types.

JDBC - Type 4 Driver - Native-Protocol Driver

Connection String Examples

The following URL connects user joel with password sydney to a database with service orcl (Important: see more on services) through port 1521 of host myhost, using the Thin driver.

jdbc:oracle:thin:joel/[email protected]//headwired.com:1521/orcl

This URL connects to the same database using the the OCI driver and the SID inst1 without specifying the username or password.

jdbc:oracle:oci:@headwired.com:1521:inst1

LoadRunner Oracle via JDBC (Java VUser)

As JDBC is widely used and documented in the Java world, we can use the Java Vuser to use the Java JDBC examples directly in our Vuser script.

Requirements

In order to script an Oracle JDBC connection you require

  1. JDBC Connection String
  2. JDK
  3. Oracle JDBC Drivers

JDK Path

As a Java VUser, the JDK location must be set. This is required to be the same for all load generators as this is a run-time setting for the script rather than the generator itself. In the example (See Figure 1) the JDK path is set to “C:\JDK\”. Note that this JDK directory must contain a “bin” directory that contains the javac.exe.

Runtime Settings - JDK

Script Type

The script type used for Java is the “Java Record Replay” or whatever you have a license for.

LR Record Replay

Database Drivers

To establish a connection to the database, we are obviously using JDBC. In this example we will be using the “Thin” drivers as they are considered to be smaller and faster than the OCI drivers, and doesn’t require a pre-installed version of the JDBC drivers. This is particularly important for managing the Oracle JDBC drivers across multiple machines. With the Thin driver, we can include the Oracle thing JDBC driver JAR files directly in our script to make them portable and not have to worry about installing them on each and every load generator.

Oracle Drivers Included

Scripting

Java vs. C

The JDBC connection script uses a Java VUser as opposed to the regular C script. As much as it would be simpler to stick with C for familiarity, as JDBC is a Java API, it made sense. There are a few small changes with Java script when compared to a C script

  1. vuser_init and vuser_end are contained in the action script
  2. Every function is different than in C (lr_start_transaction(); becomes lr.start_transaction();)
  3. You now have to worry about JDK and Class path run-time settings

It is important to consider these elements, especially point 3. The JDK run-time setting must specify the JDK location path. This path will have to be the same on ALL load generation machines.

Connecting to the Database

There are two steps in a Java to connect to an Oracle database via a JDBC connection. The first step is to dynamically load the Oracle JDBC driver class.

// Load Oracle JDBC Driver
Class.forName("oracle.jdbc.driver.OracleDriver");

The second step is to make the connection to the database using a JDBC connection string, username and password. The following example is connecting to the headwired.com host on port 1521 and the database SID of HWD.

// Specify the JDBC Connection String
String url = "jdbc:oracle:thin:@headwired.com:1521:HWD";

// Connect to URL using USERNAME and PASSWORD
connection = DriverManager.getConnection(url,"HEADWIRED",lr.decrypt("4b102b"));

Of course being Java, we have to do all the work and specify what we would like to happen if any of the steps fail. The following is an example of an init function that is designed to connect to the database and gracefully abort the Vuser if the database connection cannot be made.

// Create global connection variable
private Connection connection;

// VUser Init
public int init() throws ClassNotFoundException, SQLException {

  try {
    // Load Oracle JDBC Driver
    Class.forName("oracle.jdbc.driver.OracleDriver");
  } catch (Exception ex) {
    // If driver load is unsuccessful
    lr.log_message("Database Driver not found");
    lr.abort();
  }
  try {
    // Specify the JDBC Connection String (jdbc:oracle:thin:@HOST:PORT:SID)
    String url = "jdbc:oracle:thin:@headwired.com:1521:HWD";
    // Connect to URL using USERNAME and PASSWORD
    connection = DriverManager.getConnection(url,"HEADWIRED",lr.decrypt("4b102b"));
    lr.log_message("JDBC Connection Successful");
  } catch (SQLException e) {
    // If Connection Failed
    lr.log_message("Database Connection Failed, Please check your connection string");
    lr.abort();
  }
  return 0;
} //end of init

Database Query Function

In an effort to make scripts as easy to read and understand as possible, I have written a database query function that will return a pass or fail for the currently open transaction. This function performs a Database Query with the parsed in query. The Java code to execute a query against out JDBC connection is as follows.

String SQL_QUERY = “SELECT * FROM TABLE”;
Statement stmt = null;
ResultSet rset = null;

connection.setAutoCommit(false);
stmt = connection.createStatement();
rset = stmt.executeQuery(SQL_QUERY);
rset.close();

The results of the query can be printed using the following code. Note that logging / printing of results should be avoided in a performance test script as takes additional time and processing power to log something that we should not need to look at. This is provided for debugging purposes only.

while (rset.next()) {
  lr.log_message(rset.getString(1));
}

Being Java of course we have to provide a very verbose bit of code to get our errors handled. The following is the entire database_query function.

public int database_query(String SQL_QUERY) {
  Statement stmt = null;
  ResultSet rset = null;

  try {
    connection.setAutoCommit(false);
    stmt = connection.createStatement();
    rset = stmt.executeQuery(SQL_QUERY);
    // The transaction can be set to a Passed Status
    lr.set_transaction_status(lr.PASS);

    // Print the results (For Debugging Only)
    /*
      while (rset.next()) {
        lr.log_message(rset.getString(1));
      }
      lr.log_message("SQL Query Executed Successfully");
    */
    rset.close();
  catch (SQLException e) {
    // SQL Query has failed
    lr.log_message("Caught Exception: " + e.getMessage());
    // The transaction must be set to a Failed Status
    lr.set_transaction_status(lr.FAIL);
    return 1;
  }
  return 0;
}

Scripting a Scenario

Through the use of functions such as database_query, our actual script can be kept very clean. An example that performs three SQL queries on the database with a 5 second think time is below. Note that the example shows SELECT statements, however any SQL command could be used.

public int action() throws ClassNotFoundException, SQLException {

  // Database Query Example 1
  lr.start_transaction("Database_Query_1");
  database_query("select BANNER from VERSION");
  lr.end_transaction("Database_Query_1", lr.AUTO);

  lr.think_time(5);

  // Database Query Example 2
  lr.start_transaction("Database_Query_2");
  database_query("SELECT * from POST_DETAILS");
  lr.end_transaction("Database_Query_2", lr.AUTO);

  lr.think_time(5);

  // Database Query Example 3
  lr.start_transaction("Database_Query_3");
  database_query("select * from users");
  lr.end_transaction("Database_Query_3", lr.AUTO);

  lr.think_time(5);

  return 0;
} //end of action

Verifying the Response

In database performance testing, it is not commonplace to verify the SQL results other than to ensure that the query has been successfully executed by the server. The Java executeQuery function utilised by the database_query function will return an exception if the query is not successfully executed. The db_query function will return the first 10 records from a result set. To get the full SQL results parsed across the network, you will need to process them with the “getString” function of the resultset. In the case where keyword type checks would want to be performed on the SQL results, the same code to print the response could be used to check the results one by one with some form of validation.

Example Script

Here is the full example script for you to try. Please feel free to submit corrections or improvements.

/*
 * LoadRunner Java script.
 * Description: Oracle Database Testing via JDBC
 */

import lrapi.lr;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.*;

public class Actions
{
    // Create global connection variable
    private Connection connection;

    // VUser Init
    public int init() throws ClassNotFoundException, SQLException {
        // Initialize DB connection
        //connection = null;
        try {
	    // Load Oracle JDBC Driver
            Class.forName("oracle.jdbc.driver.OracleDriver");
        } catch (Exception ex) {
	    // If driver load is unsuccessful
	    lr.log_message("Database Driver not found");
	    lr.abort();
	}
	try {
	    // Specify the JDBC Connection String (jdbc:oracle:thin:@HOST:PORT:SID)
	    String url = "jdbc:oracle:thin:@headwired:1521:SID";
	    // Connect to URL using USERNAME and PASSWORD
	    connection = DriverManager.getConnection(url,"USER_NAME",lr.decrypt("myencryptedpasswordgoeshere"));
	    lr.log_message("JDBC Connection Successful");
        } catch (SQLException e) {
	    // If Connection Failed
	    lr.log_message("Database Connection Failed, Please check your connection string");
	    lr.abort();
	}
	    return 0;
    } //end of init

    public int action() throws ClassNotFoundException, SQLException {

	// Database Query Example 1
	lr.start_transaction("Database_Query_1");
	database_query("select BANNER from TABLE_1");
	lr.end_transaction("Database_Query_1", lr.AUTO);

	// Database Query Example 2
	lr.start_transaction("Database_Query_2");
	database_query("SELECT * from TABLE_2");
	lr.end_transaction("Database_Query_2", lr.AUTO);

	// Database Query Example 3
	lr.start_transaction("Database_Query_3");
	database_query("select * from TABLE_3");
	lr.end_transaction("Database_Query_3", lr.AUTO);

	return 0;
    } //end of action

    public int end() throws Throwable {
	connection = null;
        return 0;
    } //end of end

    // Function: database_query
    // Argument: SQL Query String
    // Performs an SQL Query String, and returns pass or fail for the current transaction
    //
    public int database_query(String SQL_QUERY) {
       Statement stmt = null;
       ResultSet rset = null;

       try {
	   connection.setAutoCommit(false);
	   stmt = connection.createStatement();
	   rset = stmt.executeQuery(SQL_QUERY);
	   lr.set_transaction_status(lr.PASS);
	   // while (rset.next()) {				// Print the results of the query
	   //     lr.log_message(rset.getString(1));  		// Note: This should be used for debugging only,
	   // }							// as it slows down execution time
	   //lr.log_message("SQL Query Executed Successfully");
	   rset.close();
	} catch (SQLException e) {
	    // SQL Query has failed
	    lr.log_message("Caught Exception: " + e.getMessage());
	    lr.set_transaction_status(lr.FAIL);
	    return 1;
	}
	return 0;
    }
}

About the Author

Joel Deutscher is an experienced performance test consultant, passionate about continuous improvement. Joel works with Planit's Technical Testing Services as a Principal Consultant in Sydney, Australia. You can read more about Joel on LinkedIn.

17 Comments

  1. Shalabh Dixit says:

    Hi,

    Thanks for such a nice article.
    Actually I tried out the above script using MySQL and it worked fine for SELECT query. But It fails for INSERT statement. below is the script i used. Please look into it and can you please tell how to insert the records.??
    Thanks in anticipation.

    /*
    * LoadRunner Java script.
    * Description: Oracle Database Testing via JDBC
    */

    import lrapi.lr;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.*;

    public class Actions
    {
    // Create global connection variable
    private Connection connection;

    // VUser Init
    public int init() throws ClassNotFoundException, SQLException
    {
    // Initialize DB connection
    //connection = null;
    try
    {
    /*// Load Oracle JDBC Driver*/
    /*Class.forName(“oracle.jdbc.driver.OracleDriver”);*/

    // Load MySQL JDBC Driver
    Class.forName(“com.mysql.jdbc.Driver”).newInstance();
    }
    catch (Exception ex)
    {
    // If driver load is unsuccessful
    lr.log_message(“Database Driver not found”);
    lr.abort();
    }
    try
    {
    // Specify the JDBC Connection String (jdbc:oracle:thin:@HOST:PORT:SID)
    /*String url1 = “jdbc:oracle:thin:@headwired:1521:SID”;*/
    String url2 = “jdbc:mysql://localhost:3306/test”;
    String username = “root”;
    String password = “1234”;

    // Connect to URL using USERNAME and PASSWORD
    connection = DriverManager.getConnection(url2,username,password);
    lr.log_message(“JDBC Connection Successful”);
    }
    catch (SQLException e)
    {
    // If Connection Failed
    lr.log_message(“Database Connection Failed, Please check your connection string”);
    lr.abort();
    }
    return 0;
    } //end of init

    public int action() throws ClassNotFoundException, SQLException
    {
    // Database Query Insert Records
    lr.start_transaction(“Database_Query_Insert_Records”);
    database_query(“INSERT INTO student (id,name) VALUES(‘A105′,’Hitesh’)”);
    lr.end_transaction(“Database_Query_Insert_Records”, lr.AUTO);

    // Database Query Fetch Records
    lr.start_transaction(“Database_Query_Fetch_Records”);
    database_query(“select * from student”);
    lr.end_transaction(“Database_Query_Fetch_Records”, lr.AUTO);

    return 0;
    } //end of action

    public int end() throws Throwable
    {
    connection = null;
    return 0;
    } //end of end

    // Function: database_query
    // Argument: SQL Query String
    // Performs an SQL Query String, and returns pass or fail for the current transaction
    //
    public int database_query(String SQL_QUERY)
    {
    Statement stmt = null;
    ResultSet rset = null;

    try
    {
    connection.setAutoCommit(false);
    stmt = connection.createStatement();
    rset = stmt.executeQuery(SQL_QUERY);
    lr.set_transaction_status(lr.PASS);
    while (rset.next())
    { // Print the results of the query
    lr.log_message(rset.getString(1));
    lr.message(“\t”);
    lr.log_message(rset.getString(2));
    lr.message(“\n”); // Note: This should be used for debugging only,
    } // as it slows down execution time
    lr.log_message(“SQL Query Executed Successfully”);
    rset.close();
    }
    catch (SQLException e)
    {
    // SQL Query has failed
    lr.log_message(“Caught Exception: ” + e.getMessage());
    lr.set_transaction_status(lr.FAIL);
    return 1;
    }
    return 0;
    }
    }

  2. vincent says:

    Hi,

    Thank you for your article. I am trying to use LoadRunner to test a Java API in a similar manner to you have done.
    Unless I am looking at the wrong load runner documentation, it would appear that the documentation is beyond useless in relation to providing instruction in this area.
    I have been forced to develop my tests by piecing together pieces of information (like your script) available on the net.
    Is there a better source of documentation to assist in creting JAVA based loadrunner scripts? I get the feeling, based on the absence of official supporting documentation, that I am using the loadRunner application outside of its envisioned usage scenario.

    Regards
    Vincent

  3. Joel Deutscher says:

    Hi Vincent,

    I have not found another resource, and generally look for resources on Java, plug the code into LoadRunner and try and start debugging. The supporting documentation only seems to list the LoadRunner specific Java calls. It could be said that this is also true of the C based scripts. I imagine this is the reason for such a strong blog community around LoadRunner.

    In my experience, there are not as many organisations with the license for Java LoadRunner scripts, which is probably why information is so sparse. Sorry I couldn’t be of more assistance.

    Joel

  4. Koushik Nandan says:

    Hi Joel,

    Thanks for such a helpful article.
    I tried to run the same on LR 11 Patch 3 and got the following error in vugen. Any guess?

    Error: Java VM internal error:Error Loading javai.dll.
    . [MsgId: MERR-22995]
    Warning: Extension java_int.dll reports error -1 on call to function ExtPerProcessInitialize [MsgId: MWAR-10485]
    Error: Thread Context: Call to service of the driver failed, reason – thread context wasn’t initialized on this thread. [MsgId: MERR-10176]

    Thanks,
    Koushik

  5. Joel Deutscher says:

    Hi Koushik,

    Which JDK are you using? In the run-time settings of the script, its worthwhile manually specifying a new (1.6+) JDK, otherwise it may pick up an older JDK. It looks as if its picking up a 1.4 JDK as I think that was the last one to contain javai.dll.

    Hope this helps,
    Joel

  6. Sagar says:

    Excellent article. Facing issue with running the same on LR11 patch 3.
    Pointed to JDK folder in the run time settings.
    Seems it has picked up JDK version 1.7.0.
    But it is still complaining about javai.dll.
    Please help.

    Notify: Found jdk version: 1.7.0. [MsgId: MMSG-22986]

    Notify: VM Params: . [MsgId: MMSG-22986]
    Error: Java VM internal error:Error Loading javai.dll.
    . [MsgId: MERR-22995]
    Warning: Extension java_int.dll reports error -1 on call to function ExtPerProcessInitialize [MsgId: MWAR-10485]
    Error: Thread Context: Call to service of the driver failed, reason – thread context wasn’t initialized on this thread. [MsgId: MERR-10176]

  7. sai says:

    Can any one please help me to resolve below problem when trying to set up message queue using Java Vuser protocol

    Notify: Found jdk version: 1.7.0. [MsgId: MMSG-22986]
    Warning: Warning: Failed to find Classes.zip entry in Classpath.
    [MsgId: MWAR-22986]
    Notify: classpath=C:\sCRIPTSD\mq\;c:\program files\hp\loadrunner\classes\srv;c:\program files\hp\loadrunner\classes;C:\Documents and Settings\kondaps1\Desktop\Message Queue Explorer\com.ibm.mq.jar;C:\Documents and Settings\kondaps1\Desktop\Message Queue Explorer\connector.jar;C:\Documents and Settings\kondaps1\Desktop\Message Queue Explorer\jta.jar;C:\Documents and Settings\kondaps1\Desktop\Message Queue Explorer\com.ibm.mq.jmqi.jar;;;;c:\program files\hp\loadrunner\lib\xstream-1.3.jar;c:\program files\hp\loadrunner\lib\xpp3-1.1.4c.jar [MsgId: MMSG-22986]
    Notify: Path=C:\Program Files\Java\jdk1.7.0_03\bin;C:\PROGRA~1\HP\LOADRU~1\bin;C:\PROGRA~1\HP\LOADRU~1\bin\gecko;C:\PROGRA~1\HP\LOADRU~1\bin\tulip\bin;C:\Program Files\Common Files\Microsoft Shared\Microsoft Online Services;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\ora10g\10.2.0\bin;C:\FileNet\IDM;C:\NETMANAG.32;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files\Common Files\Lenovo;C:\Program Files\Intel\Services\IPT\;C:\Program Files\Intel\WiFi\bin\;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\strawberry\c\bin;C:\strawberry\perl\bin;C:\Program Files\Java\jre7\bin; [MsgId: MMSG-22986]
    Notify: VM Params: . [MsgId: MMSG-22986]
    Error: Java VM internal error:Error Loading javai.dll.
    . [MsgId: MERR-22995]
    Warning: Extension java_int.dll reports error -1 on call to function ExtPerProcessInitialize [MsgId: MWAR-10485]
    Error: Thread Context: Call to service of the driver failed, reason – thread context wasn’t initialized on this thread. [MsgId: MERR-10176]

  8. Joel Deutscher says:

    Hi Sai,

    I haven’t recieved this error myself, though I would start at the beginning. The first warning message is “Failed to find Classes.zip entry in Classpath.”. A quick google search found the following answer (http://www.sqaforums.com/showflat.php?Number=111767)

    You need the MI classes under the LoadRunner directory to be in your classpath. You can simply zip up Loadrunner\classes in a classes.zip and add that to the CLASSPATH environment variable.
    javai.dll, java_int.dll – Java Interpreter & runtime handler.

    If you don’t make any progress, I would suggest posting the question on something like Stack Overflow.

    Good luck and don’t forget to post back here if you get an answer.

    Regards,
    Joel

  9. shourya says:

    hey Joel,
    followed your footprints, now i am able to make a connection to DB and executed a query. now i want to save the result into a parameter and read the result.

    can you help with the sample code?

    regards
    shourya

  10. Tony says:

    Hi,

    I am stuck at:

    —————
    Virtual User Script started
    Starting action vuser_init.
    Database Driver not found
    —————
    public int init() throws ClassNotFoundException, SQLException {
    // Initialize DB connection
    //connection = null;
    try {
    // Load Oracle JDBC Driver
    Class.forName(“oracle.jdbc.driver.OracleDriver”);
    } catch (Exception ex) {
    // If driver load is unsuccessful
    lr.log_message(“Database Driver not found”);

    Classpath: C:\Program Files\Java\jdk1.6.0_18
    Java VM: Use specified JDK JDK = C:\Program Files\Java\jdk1.6.0_18

  11. Azmat Ali says:

    Hi Joel,

    First of all thank you for such a nice article. I have tried the same script with a shorter version just to test and got following Log which contain 2 errors can you please help me out in this matter

    Notify: Found jdk version: 1.7.0. [MsgId: MMSG-22986]

    Warning: Warning: Failed to find Classes.zip entry in Classpath.
    [MsgId: MWAR-22986]
    Notify: classpath=C:\Users\azmat.ali\Desktop\Orcl_connect\;c:\program files\hp\loadrunner\classes\srv;c:\program files\hp\loadrunner\classes;C:\Program Files\Java\jdk1.7.0\bin;C:\Program Files\Java\jre6;;;;c:\program files\hp\loadrunner\lib\xstream-1.3.jar;c:\program files\hp\loadrunner\lib\xpp3-1.1.4c.jar [MsgId: MMSG-22986]
    Notify: Path=C:\Program Files\Java\jdk1.7.0\bin;C:\PROGRA~1\HP\LOADRU~1\bin;C:\PROGRA~1\HP\LOADRU~1\bin\gecko;C:\PROGRA~1\HP\LOADRU~1\bin\tulip\bin;D:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\Program Files\PC Connectivity Solution\;C:\Program Files\Dell\DW WLAN Card;;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files\Roxio\OEM\AudioCore\;C:\strawberry\c\bin;C:\strawberry\perl\bin; [MsgId: MMSG-22986]
    Notify: VM Params: . [MsgId: MMSG-22986]
    Notify: Unable to initialize threads: cannot find class java/lang/Thread
    [MsgId: MMSG-22986]

    Error: Unable to create Java VM. [MsgId: MERR-22994]

    Warning: Extension java_int.dll reports error -1 on call to function ExtPerProcessInitialize
    [MsgId: MWAR-10485]

    Error: Thread Context: Call to service of the driver failed, reason – thread context wasn’t initialized on this thread. [MsgId: MERR-10176]

  12. Azmat Ali says:

    Hi once again joel,

    Now what i have done is zipped the loadrunner classes folder and added in class path and got the below log . Unable to Create Java VM is still there with java/lang/thread issue

    Notify: Found jdk version: 1.7.0. [MsgId: MMSG-22986]
    Notify: classpath=C:\Users\azmat.ali\Desktop\Orcl_connect\;c:\program files\hp\loadrunner\classes\srv;c:\program files\hp\loadrunner\classes;C:\Program Files\Java\jdk1.7.0\jre\bin;C:\Program Files\Java\jdk1.7.0\jre\lib;C:\Program Files\HP\LoadRunner\classes;C:\Program Files\Java\jdk1.7.0\bin;C:\Program Files\HP\LoadRunner\classes.zip;;;;c:\program files\hp\loadrunner\lib\xstream-1.3.jar;c:\program files\hp\loadrunner\lib\xpp3-1.1.4c.jar [MsgId: MMSG-22986]
    Notify: Path=C:\Program Files\Java\jdk1.7.0\bin;C:\PROGRA~1\HP\LOADRU~1\bin;C:\PROGRA~1\HP\LOADRU~1\bin\gecko;C:\PROGRA~1\HP\LOADRU~1\bin\tulip\bin;D:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\Program Files\PC Connectivity Solution\;C:\Program Files\Dell\DW WLAN Card;;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files\Roxio\OEM\AudioCore\;C:\strawberry\c\bin;C:\strawberry\perl\bin; [MsgId: MMSG-22986]
    Notify: VM Params: . [MsgId: MMSG-22986]

    Notify: Unable to initialize threads: cannot find class java/lang/Thread
    [MsgId: MMSG-22986]
    Error: Unable to create Java VM. [MsgId: MERR-22994]

    Warning: Extension java_int.dll reports error -1 on call to function ExtPerProcessInitialize [MsgId: MWAR-10485]

    Error: Thread Context: Call to service of the driver failed, reason – thread context wasn’t initialized on this thread. [MsgId: MERR-10176]

  13. Azmat Ali says:

    Now i have done another update. In run time settings i have selected option of “use internal logic to locate JDK” and after that compilation is done without any errors but when i played script it gave me following errors

    Notify: Found jdk version: 1.3.1.
    Notify: classpath=C:\Users\azmat.ali\Desktop\Orcl_connect\;c:\program files\hp\loadrunner\classes\srv;c:\program files\hp\loadrunner\classes;C:\Program Files\Java\jdk1.7.0\jre\bin;C:\Program Files\Java\jdk1.7.0\jre\lib;C:\Program Files\HP\LoadRunner\classes;C:\Program Files\Java\jdk1.7.0\bin;C:\Program Files\HP\LoadRunner\classes.zip;;;;c:\program files\hp\loadrunner\lib\xstream-1.3.jar;c:\program files\hp\loadrunner\lib\xpp3-1.1.4c.jar
    Notify: Path=C:\Program Files\Oracle\jre\1.3.1\bin\hotspot;C:\PROGRA~1\HP\LOADRU~1\bin;C:\PROGRA~1\HP\LOADRU~1\bin\gecko;C:\PROGRA~1\HP\LOADRU~1\bin\tulip\bin;D:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\Program Files\PC Connectivity Solution\;C:\Program Files\Dell\DW WLAN Card;;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files\Roxio\OEM\AudioCore\;C:\strawberry\c\bin;C:\strawberry\perl\bin;C:\Program Files\Java\jdk1.7.0\bin;C:\Program Files\Java\jdk1.7.0\jre\bin;C:\Program Files\Java\jdk1.7.0\jre\lib;
    Notify: VM Params: .
    Error: at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at DummyClassLoader.loadClass(DummyClassLoader.java:33)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at DummyClassLoader.getScriptObject(DummyClassLoader.java:133)

    Error: Can’t create script object.
    Error: Exception was raised when calling abort-cleanup function in extension java_int.dll: System Exceptions: EXCEPTION_ACCESS_VIOLATION
    Warning: Extension trans.dll reports error -1 on call to function ExtAbortCleanup

  14. Azmat Ali says:

    Hi Joel,
    Having same issue with LR 11 and JDK 1.7 but its giving error of Javai.dll as posted by sagar.

  15. Azmat Ali says:

    Hi Joel,
    Please also tell about the classes12.jar which you have added in script file.

  16. Azmat Ali says:

    Hi,

    My All errors resolved now . Now script is executing Select statement but not executing Update statement.

    can we only use Select query with this? Whenever i try to execute a simple update statmenet i get the following log and its just stuck there and never moves forward

    Virtual User Script started at : 2012-07-26 10:42:00
    Starting action vuser_init.
    Database Driver successfull found
    JDBC Connection Successful
    Ending action vuser_init.
    Running Vuser…
    Starting iteration 1.
    Starting action Actions.

    Please please please suggest in this regard .

  17. Jay says:

    Hi Joel,

    I am using HP Virtual User Generator 11.00.0.0.
    In the run time settings i have specified C:\Program Files\Java\jdk1.7.0_05.
    This location has the bin folder and the bin folder has the javac.exe file.

    I am trying to execute a script but getting the same Error as Sagar and Sai:

    Notify: Found jdk version: 1.7.0. [MsgId: MMSG-22986]
    Notify: classpath=C:\LOAD RUNNER\Jay\1\;c:\program files\hp\virtual user generator\classes\srv;c:\program files\hp\virtual user generator\classes;C:\LOAD RUNNER\classes.zip;;;;c:\program files\hp\virtual user generator\lib\xstream-1.3.jar;c:\program files\hp\virtual user generator\lib\xpp3-1.1.4c.jar [MsgId: MMSG-22986]
    Notify: Path=C:\Program Files\Java\jdk1.7.0_05\bin;C:\PROGRA~1\HP\VIRTUA~1\bin;C:\PROGRA~1\HP\VIRTUA~1\bin\gecko;C:\PROGRA~1\HP\VIRTUA~1\bin\tulip\bin;C:\oracle\product\11.1.0\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Windows Imaging\;C:\Program Files\Encentuate\AccessAgent\Integration\Carefx\Fusionfx;C:\Program Files\Encentuate\;C:\strawberry\c\bin;C:\strawberry\perl\bin;C:\Program Files\Enterprise Vault\EVClient\; [MsgId: MMSG-22986]
    Notify: VM Params: . [MsgId: MMSG-22986]
    Error: Java VM internal error:Error Loading javai.dll.
    . [MsgId: MERR-22995]
    Warning: Extension java_int.dll reports error -1 on call to function ExtPerProcessInitialize [MsgId: MWAR-10485]
    Error: Thread Context: Call to service of the driver failed, reason – thread context wasn’t initialized on this thread. [MsgId: MERR-10176]

    Any help will be appreciated.
    Thanks !