Setting Up a JMeter Instance on the Cloud to Inject Load Against Microsoft SQL Azure

So, you want to set-up load injection capabilities on the Amazon EC2 cloud to throw load against a Microsoft SQL Azure database?

This quick tutorial will show you how to do the following:

  • Setting up Apache JMeter (version 2.4 as of this post) on the Amazon EC2 Cloud
  • Setting up appropriate JDBC drivers
  • Setting the correct connection attributes to be able to successfully connect to the Microsoft SQL Azure database

Setting up Apache JMeter on an Amazon EC2 instance

The following instructions should work on any EC2 instance. I used a standard Server 2008 R2 x64 AMI.

Firstly, download the JMeter file and extract it somewhere local like your C drive.
Next, run the jmeter.bat file located in the /bin directory.

if you get a ‘java is not a recognised’ error or something similar, make sure you have the latest JDK installed. You may also need to add the JDK bin directory to the Windows environmental paths (this was not automatically done on the instance I was setting up)

Setting up the appropriate JDBC drivers

For JMeter to be able to connect to a Microsoft SQL Azure database, you need to provide JMeter the correct JDBC drivers (which are quite specific) to work with.

The JDBC driver you need is provided directly by Microsoft. You can download the Microsoft JDBC Driver 3.0 for SQL Server and SQL Azure from here.

After you have downloaded the JDBC driver package, extract it and place the files named below in the JMeter/lib directory (make sure you retrieve the files relevant to the instance architecture… i.e., 32bit vs. 64bit):

  • sqljdbc4.jar (found in the ‘Microsoft SQL Server JDBC Driver 3.0\sqljdbc_3.0\enu‘ directory)
  • sqljdbc_auth.dll (found in the ‘Microsoft SQL Server JDBC Driver 3.0\sqljdbc_3.0\enu\auth‘ directory)
  • sqljdbc_xa.dll (found in the ‘Microsoft SQL Server JDBC Driver 3.0\sqljdbc_3.0\enu\xa‘ directory)

Rename sqljdbc4.jar to sqljdbc.jar so that JMeter will recognise it as a JDBC driver.

That should be all!

Setting up the connection attributes

Once you have set-up JMeter and successfully installed the JDBC drivers for SQL Azure connectivity, you are ready to set-up the connection strings in JMeter for connectivity.

The below configuration is used in the JMeter ‘JDBC Connection Configuration‘ configuration element; these are the settings JMeter will use to connect to your SQL Azure database.

Database URL: jdbc:sqlserver://<serverName>;databaseName=<databaseName>

JDBC Driver class:

Username: username@serverName

Password: yourPassword

That should be it… you should now be able to successfully connect and inject load to your SQL Azure database :)

This article was written by me on the Capacitas© Blog

This entry was posted in Tech and tagged , , , , , . Bookmark the permalink.

2 Responses to Setting Up a JMeter Instance on the Cloud to Inject Load Against Microsoft SQL Azure

  1. Mahendra says:

    Dear Sir,

    I followed same method mentioned here. But My Jmeter is not making any connections to the database. I copied jdbc drivers into /lib directory as followed.

    These Errors we are facing in Jmeter Log Files -
    WARN – jmeter.protocol.jdbc.config.DataSourceElement: Could not return Connection java.sql.SQLException: No suitable driver found for jdbc:sqlserver://serverip:1433;databaseName=dbname

    WARN – jmeter.protocol.jdbc.config.DataSourceElement: Could not return Connection java.lang.Exception: Could not create enough Components to service your request (Timed out).

    Please response us asap
    Thanks & Regards

    • E Mikail T says:

      First delete the ‘sqljdbc4.jar’ as you do not need it. As per instructions, copy if over and rename to sqljdbc.jar.
      Second, can you make sure your Azure firewall settings are set so the load injector can see the database server?
      Did you use the correct .dll files according to your load injector architecture? (32bit vs 64bit)
      Can you also provide a screenshot of the JMeter JDBC screen so I can see your connection parameters/strings? (blank out your username and pass!)

Comments are closed.