To do a JDBC request, first understand what this JDBC object is, and then look for the database connection URL and database driver for the response.
Database Url:jdbc:sqlserver://200.99.197.190:1433;databasename=ebank
Database driver: Com.microsoft.sqlserver.jdbc.SQLServerDriver
Download Sqljdbc4.jar under Apache-jmeter-2.6\lib
SQL Server driver package (JAR) Name:
Microsoft+sql+server+jdbc+driver+3.0sqljdbc_3.0.1301.101_chs.exe
--Download and unzip put the Sqljdbc4.jar under the Apache-jmeter-2.6\lib
I use a connection database to specify the driver class, but also some people use the Jtds open source community driver class, different driver classes corresponding to the jar is different, be sure to pay attention to.
Connecting the database specifies the driver class (you can download the standard version of SQL Server driver)
ClassName = "Com.microsoft.jdbc.sqlserver.SQLServerDriver";
Access database URL = "JDBC:MICROSOFT:SQLSERVER://LOCALHOST:1433;DATABASENAME=DB_JXC; Selectmethod=cursor ";
Jtds Open Source Community driver class (do not know where to download, Jtds open source community?)
Class.forName (Net.sourceforge.jtds.jdbc.Driver). newinstance ();
Drivermanager.getconnection ("jdbc:jtds:sqlserver://localhost:1433/" + "library", "User", "password");
Datebase |
Driver class |
Database URL |
Mysql |
Com.mysql.jdbc.Driver |
Jdbc:mysql://host:port/{dbname} |
PostgreSQL |
Org.postgresql.Driver |
Jdbc:postgresql:{dbname} |
Oracle |
Oracle.jdbc.driver.OracleDriver |
Jdbc:oracle:thin:user/[email Protected]//host:port/service |
Ingres (2006) |
Ingres.jdbc.IngresDriver |
Jdbc:ingres://host:port/db[;attr=value] |
MSSQL |
Com.microsoft.sqlserver.jdbc.SQLServerDriver Or Net.sourceforge.jtds.jdbc.Driver |
Jdbc:sqlserver://ip:1433;databasename=dbname Or jdbc:jtds:sqlserver://localhost:1433/"+" library " |
The database driver class and URL format are collected in the table above
Add JDBC Default connection request, that is, MS SQL connection information: Database URL ( different driver classes have different connection strings ), MSSQL driver class, database user name password.
Add a JDBC request, here is the stored procedure statement I executed. The statements are parameterized
Parameterization is done with the JMeter control, without the function helper.
The assertion is also used in this script because there is a SQL return value in the JDBC request (stored procedure), and if it returns to 1, the stored procedure executes successfully
JMeter (eight)-JDBC request (SQL Server)