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>.database.windows.net;databaseName=<databaseName>
JDBC Driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver
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