Monday 21 March 2011

Postgresql database configuration for Jmeter GUI mode


Hi everyone, I know some geeks might be searching for the postgresql database configuration for Jmeter GUI mode on Google, like I was looking it before when I started testing the postgresql.
It is very easy! How? Let see.
First download the postgresql driver class for JMeter. There are two driver classes available on postgresql website. JDBC3 Postgresql Driver, Version 9.0-801 this driver class only supports JVM 1.4 version, SSL and the javax.sql package. If you are using 1.6 JVM, like me then go for JDBC4 Postgresql Driver, Version 9.0-801. Once you download the driver class then paste it into “C: / JMeter / lib”.
Now start/open the JMeter, you will see two things (Test Plan and WorkBench). Now right click on the Test Plan --> Add --> Config Element --> JDBC Connection Configuration. JDBC Connection Configuration will be added under Test Plan.
Click on the JDBC Connection Configuration and enter “Postgresql” under variable name field. You will be using this variable in your all database requests. Now enter“10” in Max Number of Connections, “10000” in pool timeout, “60000” in Idle cleanup interval (ms), set Auto Commit to “True”, select “True” for Keep-Alive field, “5000”for Max Connection age (ms), Validation Query “Select1”.
Now under Database Connection Configuration enter following details:
Database URL: jdbc : postgresql : //IPAddress : PortNo/DatabaseName?autoReconnect=true
JDBC Driver class: org.postgresql.Driver
Username: username of database
Password: password of database
Create a Thread Group now by right click on the Test Plan --> Add --> Threads (Users) --> Thread Group. Now under Thread Group add JDBC request by right click on the Thread Group --> Sampler --> JDBC Request. Under JDBC Request enter same Variable Name which we used in the JDBC Connection Configuration “Postgresql”.
Now type your own query or (select * from tablename ; ) and see the result in “View Result Tree”.
Hurray! we have done the configuration for Postgresql in JMeter. Now you can do whatever you want.
EXCEPT DROP :-)

2 comments: