2013-01-29

JMeter Load Testing with Cassandra/MySql/Derby/SQLite/Ingres/PostgreSQL/Oracle/MS Access

In this article we are going to see how can we perform DB testing for other DB than MS SQL.


We can find driver class and DB url patterns from my previous post.
The common steps we can find from my post here. We have to change the driver , and the class/db url from that post only.
So, the drivers(.jar file) for different DBs are located in following links.
For Oracle: Driver link is here
For MySQL: Driver link is here
For PostgreSQL: Driver link is here
For Ingres (2006): Driver link is here(parent link here)
For Apache Derby: Driver link is here(extract one release and get derbyclient.jar from lib)
For SQL Server (Sourgeforge Driver): Driver link is here
For Cassandra : Driver link is here
For SQLite: Driver link is here or (this or this )
For Microsoft Access(ODBC bridged) : No Need to Download Driver (for more idea, see this)
For Microsoft Access(StelsMDB) : Driver link is here

I have tested on mysql, sql server(2005, 2008, sqlexpress)

Note : All DB list here . When we need to test any specific one, wither we have find the driver or we may have to write the driver in JAVA.

Thanks..:)

2013-01-28

Driver classes & Database URLs for JDBC Drivers

In this article we will see different Driver class & Database URL pattern(syntax) used with JDBC driver in JAVA. We will use them with JMeter under JDBC Connection Configuration config element.
See my SQL testing post for know more about SQL testing.

Database Name : MySQL
Driver class: com.mysql.jdbc.Driver
Database URL :jdbc:mysql://host[:port]/dbname

Database Name : PostgreSQL
Driver class: org.postgresql.Driver
Database URL : jdbc:postgresql:{dbname}

Database Name : Oracle
Driver class: oracle.jdbc.OracleDriver
Database URL : jdbc:oracle:thin:@//host:port/service
OR
jdbc:oracle:thin:@(description=(address=(host={mc-name})(protocol=tcp)(port={port-no}))(connect_data=(sid={sid})))

Database Name : Ingres (2006)
Driver class: ingres.jdbc.IngresDriver
Database URL : jdbc:ingres://host:port/db[;attr=value]

Database Name : Apache Derby
Driver class: org.apache.derby.jdbc.ClientDriver
Database URL : jdbc:derby://server[:port]/databaseName[;URLAttributes=value[;...]]

Database Name : SQL Server (MS JDBC driver)
Driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver
Database URL : jdbc:sqlserver://host:port;DatabaseName=[dbname]
OR 
 jdbc:sqlserver://host:port;instanceName=[sqlexpress];DatabaseName=[dbname]


Database Name : SQL Server (Sourgeforge Driver)
Driver class: net.sourceforge.jtds.jdbc.Driver
Database URL : jdbc:jtds:sqlserver:// [server name or ip] / [db name]

Database Name : MS Acces [ODBC bridged]
Driver class: sun.jdbc.odbc.JdbcOdbcDriver
Database URL : jdbc:odbc:dsn", "", ""

Database Name : MS Acces( StelsMDB)
Driver class: jstels.jdbc.mdb.MDBDriver2
Database URL : jdbc:jstels:mdb:
For more idea, see this

Database Name : cassandra-jdbc
Driver class:org.apache.cassandra.cql.jdbc.CassandraDriver
Database URL : jdbc:cassandra://host:port/dbName;

Database Name : SqlLite
Driver class: org.sqlite.JDBC
Database URL : jdbc:sqlite:sample.db


This is all from the jmeter doc. I mention separately to help other in finding them. 
I will try to increase more driver syntax incrementally.

Thanks ...:)

How to perform MSSQL load testing in JMeter?

In this article we are going to see how to perform Load / Stress test for MS SQL Server. It is applicable for SQL 2008, 2005, SQL Express.

For Basic Idea on jmeter, See my this post.

Step : 1 
To Test Database, we have to access the database directly as jmeter does not send request via browser. So,we need a driver or communication way to access DB. As Jmeter is build on JAVA, so we have to use JDBC driver. JDBC driver is different for different Database Server. As we are focused on MS SQL in this post, we will be needing a JDBC driver.
I am using MS SQL Server jdbc driver 4.0. Download the from here(download). 
[Note : Use sqljdbc4.jar . sqljdbc.jar is for old java versions]

Step : 2
-After download driver , Unzip and we will get sqljdbc4.jar we have to copy this to \apache-jmeter-2.8\lib (Library Directory)
 

Step : 3 
- Run Jmeter

Step : 4 
-Add a Thread Group to default test plan(I use 2 user, 1 second, 2 iteration)

Step : 6 
-Add a JDBC Connection Configuration under thread group( it is one kind of Config Element)
[This will control the settings to communicate with database]

Step : 7 
-Provide a Variable Name
Note : Every Variable name represents a configuration settings, so if we add more JDBC Connection Configuration, each one should identically differently from other by variable names. I use SQL Authentication,
Database Connection Configuration :  
Database URL: jdbc:sqlserver://[server address];databaseName=[DataBase Name]
JDBC Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver
Username: (Ex-shantonu)
Password: (Ex-p@ssw0rD)
You can find the syntax details here

Step : 8 
-Add JDBC Request( it is one kind of Sampler) under the thread group. [This sends the query, procedure on DB]

Step : 9 
- Provide Variable Name as the mane from JDBC Connection Configuration. This name should be same as any one of JDBC Connection Configuration that is present in the test plan.

So,
-We have to add sql query in SQL Section. This is the the test query that will be using for load in the Database. I have tasted
1. Local SQLEXPRESS : "Select count(*) from t_TestTable"
2. Remote Server : Select COUNT(*) from Configurations







My sample Database Structure :
- Select the type of Query




Note : We can also use Sourceforge provide a JDBC driver (JTDL for MSSQL Server) link. 
In that Case :
Database URL jdbc:jtds:sqlserver:// [server name or ip] / [db name]]
JDBC Driver Class: net.sourceforge.jtds.jdbc.Driver
Username: (Ex-shantonu)
Password: (Ex-p@ssw0rD)

Note :
-If you use SQLExpress don't miss the followings a: Active SQL Express Service, b: Active  SQL Express Browsing Service, c: Active  SQL Express Browsing enabled from TCP/IP ( Use SQL Server Configuration Manager)
-It is better to Use SQL Authentication (so, know your sa password. This link might help)
-If you do not use SQL Authentication the Database URL : jdbc:sqlserver://[server address];instanceName=[name];databaseName=[dbName]

-Add listeners, You can add any kind of listeners, I have used only View Results in tree.

Now, Run the Test and monitor the data.

...Thanks....:)