Oracle DataBase Testing By Jmeter



Let's start for JMeter tutorial, how to connect database and all:
Start the jmeter from */*/bin/jmeter.bat. Where * indicate the your dir in windows.
A window will appear with title bar Apache jmeter.









For accessing any database need to configure respective driver (lib ojdbc6.jar).

INFO  - jmeter.engine.StandardJMeterEngine: Running the test!
INFO  - jmeter.samplers.SampleEvent: List of sample_variables: []
WARN  - jmeter.protocol.jdbc.config.DataSourceElement: Could not load driver: oracle.jdbc.OracleDriver java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)


Simple need to place the jdbc jar file in jmeter lib dir. After that need to start again jmeter for further development, once you restart copy jar file will load in jmeter container and available for further use.

Now, create the JDBC Connection Configuration, for this need to Right Click on Test Plan >
Add > Config Element > JDBC Connection Configuration.

Note: This will be there for project or Thread group level.

















Enter the data base details as mention in below image,
Name: JDBCConnectionConfiguration
Variable Name: nameofconnectionordatabase

Connection pool Configuration:

Max Number of Connections: 1 or n as per your db support.

In database connection configuration section:
Database URL: jdbc:oracle:thin:@//IPAddressofdatabase:port/sid
e.g: jdbc:oracle:thin:@//1.1.1.0:1234/nameofsid
JDBC Drive Class: oracle.jdbc.OracleDriver
User name and Password
















For more details refer the http://jmeter.apache.org/

Right click on the My Thread Group > Sampler > JDBC Request
Enter the name of connect variable what we have added for JDBC Connection Configuration.
In Variable Name: nameofconnectionordatabase
Select the respective DML for me I selected the select statement.
Whatever query you have in query section.
e.g select * from dual;














Create the summary report > right click on the My Thread Group > Add > Listener > Summary Report.










Save it with your love name.
Click on the Test Plan and run it from tab button or from Run > Start.
You will able to see some result like above screen.




JDBCOracle.jxm file will same, We can use this file for running from Unxi system:
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.6" jmeter="2.11 r1554548">
  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
      <stringProp name="TestPlan.comments"></stringProp>
      <boolProp name="TestPlan.functional_mode">false</boolProp>
      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
        <collectionProp name="Arguments.arguments"/>
      </elementProp>
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
    </TestPlan>
    <hashTree>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="My Thread Group" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <stringProp name="LoopController.loops">1</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <longProp name="ThreadGroup.start_time">1421937486000</longProp>
        <longProp name="ThreadGroup.end_time">1421937486000</longProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </ThreadGroup>
      <hashTree>
        <JDBCSampler guiclass="TestBeanGUI" testclass="JDBCSampler" testname="JDBC Request" enabled="true">
          <stringProp name="dataSource">nameofconnectionordatabase</stringProp>
          <stringProp name="query">select * from dual</stringProp>
          <stringProp name="queryArguments"></stringProp>
          <stringProp name="queryArgumentsTypes"></stringProp>
          <stringProp name="queryTimeout"></stringProp>
          <stringProp name="queryType">Select Statement</stringProp>
          <stringProp name="resultVariable"></stringProp>
          <stringProp name="variableNames"></stringProp>
        </JDBCSampler>
        <hashTree/>
        <ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary Report" enabled="true">
          <boolProp name="ResultCollector.error_logging">false</boolProp>
          <objProp>
            <name>saveConfig</name>
            <value class="SampleSaveConfiguration">
              <time>true</time>
              <latency>true</latency>
              <timestamp>true</timestamp>
              <success>true</success>
              <label>true</label>
              <code>true</code>
              <message>true</message>
              <threadName>true</threadName>
              <dataType>true</dataType>
              <encoding>false</encoding>
              <assertions>true</assertions>
              <subresults>true</subresults>
              <responseData>false</responseData>
              <samplerData>false</samplerData>
              <xml>false</xml>
              <fieldNames>false</fieldNames>
              <responseHeaders>false</responseHeaders>
              <requestHeaders>false</requestHeaders>
              <responseDataOnError>false</responseDataOnError>
              <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
              <assertionsResultsToSave>0</assertionsResultsToSave>
              <bytes>true</bytes>
            </value>
          </objProp>
          <stringProp name="filename"></stringProp>
        </ResultCollector>
        <hashTree/>
      </hashTree>
      <JDBCDataSource guiclass="TestBeanGUI" testclass="JDBCDataSource" testname="JDBCConnectionConfiguration" enabled="true">
        <boolProp name="autocommit">true</boolProp>
        <stringProp name="checkQuery">Select 1</stringProp>
        <stringProp name="connectionAge">5000</stringProp>
        <stringProp name="dataSource">nameofconnectionordatabase</stringProp>
        <stringProp name="dbUrl">jdbc:oracle:thin:@//IPAddress:Port/SID</stringProp>
        <stringProp name="driver">oracle.jdbc.OracleDriver</stringProp>
        <boolProp name="keepAlive">true</boolProp>
        <stringProp name="password">Password_schema</stringProp>
        <stringProp name="poolMax">1</stringProp>
        <stringProp name="timeout">10000</stringProp>
        <stringProp name="transactionIsolation">DEFAULT</stringProp>
        <stringProp name="trimInterval">60000</stringProp>
        <stringProp name="username">User_Schema</stringProp>
      </JDBCDataSource>
      <hashTree/>
    </hashTree>
  </hashTree>
</jmeterTestPlan>

Learn from any stage any time, don't limit your self time to learn.

43 comments:

  1. Replies
    1. Thanks Ravindra for your kind response on Oracle DataBase Testing By Jmeter post.
      With this we can perform the load testing of database. Single script or groups...

      Delete
  2. good about database testing in jmeter, explain more about load testing...

    ReplyDelete
  3. hi can u tell how can i pass the result of one sql query as an input to another sql query..?
    suppose we get rollno as a result from 1st query so i will pass that rollno to another query to get the
    address or any thing related to that student.

    ReplyDelete
    Replies
    1. Just open the your test plan and click on the jmeter help you will get full details in JDBC Request where you can use in as mention below and you can use it as sql inside sql or nested sql.
      queryArguments and type.

      18.1.3 JDBC Request
      This sampler lets you send an JDBC Request (an SQL query) to a database.
      Before using this you need to set up a JDBC Connection Configuration Configuration element
      If the Variable Names list is provided, then for each row returned by a Select statement, the variables are set up with the value of the corresponding column (if a variable name is provided), and the count of rows is also set up. For example, if the Select statement returns 2 rows of 3 columns, and the variable list is A,,C , then the following variables will be set up:

      A_#=2 (number of rows)
      A_1=column 1, row 1
      A_2=column 1, row 2
      C_#=2 (number of rows)
      C_1=column 3, row 1
      C_2=column 3, row 2

      Delete
    2. The process of working with JDBC Test Elements results is covered in depth in the Debugging JDBC Sampler Results in JMeter guide.

      Delete
    3. Good way to do your web site URL advertisement...
      http://www.tutorialbyexample.com/2015/02/oracle-database-testing-jmeter-tutorials.html

      Delete
  4. Just open the your test plan and click on the jmeter help you will get full details in JDBC Request where you can use in as mention below and you can use it as sql inside sql or nested sql.
    queryArguments and type.

    18.1.3 JDBC Request
    This sampler lets you send an JDBC Request (an SQL query) to a database.
    Before using this you need to set up a JDBC Connection Configuration Configuration element
    If the Variable Names list is provided, then for each row returned by a Select statement, the variables are set up with the value of the corresponding column (if a variable name is provided), and the count of rows is also set up. For example, if the Select statement returns 2 rows of 3 columns, and the variable list is A,,C , then the following variables will be set up:

    A_#=2 (number of rows)
    A_1=column 1, row 1
    A_2=column 1, row 2
    C_#=2 (number of rows)
    C_1=column 3, row 1
    C_2=column 3, row 2

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
    Replies
    1. Mervin, I will suggest don't do advertisement of you course and website if you have any concerns and daubt about my post feel free do let me know.....I'm seeing your people are putting comment for advertisement in my website. Hopping you people understood it. Let me know if you have question, jmeter tutorial or testing will more then happy to answer. But this is not at all write place to advertise your site, will charge going forward if you want to do it....and i found it.

      Delete
  6. Directly hitting database table...and data for test... by soapui, how to know good performance or bad?

    ReplyDelete
    Replies
    1. Thanks for info, however you miss line mention above ...
      Connection pool Configuration:

      Max Number of Connections: 1 or n as per your db support.

      In database connection configuration section:
      Database URL: jdbc:oracle:thin:@//IPAddressofdatabase:port/sid
      e.g: jdbc:oracle:thin:@//1.1.1.0:1234/nameofsid
      JDBC Drive Class: oracle.jdbc.OracleDriver
      User name and Password

      and for performance you can see reports...

      Delete
  7. good example in jmeter for database testing..

    ReplyDelete
  8. This comment has been removed by a blog administrator.

    ReplyDelete
  9. This comment has been removed by a blog administrator.

    ReplyDelete
  10. may i know where can i get the ojdbc6 jar file?

    ReplyDelete
    Replies
    1. You can download ojdbc6.jar from http://www.java2s.com/Code/Jar/o/Downloadojdbc6jar.htm or or if you can do from oracle web site.

      Delete
  11. hi,this is not related to db connections,Can i know the how we can take screenshots of failed test in jmeter

    ReplyDelete
    Replies
    1. Thanks for your question, you can use tool "ffmpeg" and pass the parameter for capturing the screen.

      Delete
  12. Good and nice blog post, thanks for sharing your information.. it is very useful to me.. keep rocks and updating.. Real User Monitoring

    ReplyDelete
  13. thanks very much for your help

    ReplyDelete
  14. Thank you a lot for providing individuals with a very
    spectacular possibility to read critical reviews from this site.

    java training in chennai


    java training in bangalore

    ReplyDelete
  15. This comment has been removed by a blog administrator.

    ReplyDelete
  16. http://www.ciitnoida.com/ is worst institute, don't pay else they will still your money, and even though not provide training.

    ReplyDelete
  17. I think this is the best article today. Thanks for taking your own time to discuss this topic, I feel happy about that curiosity has increased to learn more about this topic. Keep sharing your information regularly for my future reference.
    Java Courses in chennai

    ReplyDelete
    Replies
    1. Very good post.

      Please have look for AWS and DevOps Training online or corporate www.a2info.com.

      Delete
  18. Thank you for written this blog regarding to core technology.This is very Helpful and informative blog.
    aws training in bangalore

    java training in bangalore

    ReplyDelete
  19. Wonderful blog & good post.Its really helpful for me, awaiting for more new post. Keep Blogging!
    Web Design Training

    ReplyDelete
  20. This is done keeping in view the probability of anyone accessing the vital data on the database and tampering it. No unauthorized person can login to the database.dbdesigner.net

    ReplyDelete
  21. This article is well written and quite informative.
    More articles should be written and you have just found a follower.and more visit.
    mainframe training in hyderabad

    ReplyDelete
  22. Do not wait for luck, catch it by the tail. best internet casino games Then come to us and win.

    ReplyDelete
  23. Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information.
    Loadrunner Training in Noida

    ReplyDelete
  24. This is a very amazing post for cheap web hosting services. in this post, you have provided all the basic information regarding.

    website builder for reseller

    ReplyDelete
  25. Comfortabl y, the post is really the freshest on that deserving topic. I harmonise with your conclusions and definitely will thirstily look forward to your next updates.

    private label website builder

    ReplyDelete
  26. Thank you for the link building list.I am going jot down this because it will help me a lot.Great blog! Please keep on posting such blog.

    white label website builder

    ReplyDelete

Please provide your input, it will honer for me...