Jmeter JDBC Request -- sqlserver JDBC driver configuration, sqlserverjdbc driver
1. Make a JDBC requestFirst, you need to know what the JDBC object is. Now SQL Server is used as an example to describe it.
First, download the corresponding database driver. I have uploaded it to my online storage. Please download it directly without using the points in csdn.
Address: Http://yunpan.cn/QaEjwXyXFrA5H (extract code: 1f35)
Note:: After the download is complete, change sqljdbc4.zip to the jar suffix. And put it under the apache-jmeter-2.6 \ lib.
2,For details about how to create a Jmeter project, see (Add Configuration element JDBC Connection Configuration)
For more information about the URL and JDBC driver, see the table below (PS: Jmeter help is also available)
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/pass @ // 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" |
3,Enter the SQL statement you want in the request.(Note: Variable name is the name you wrote above)
4. Directly test and check whether the call is successful.If the connection to port 1433 fails, check whether the connection to port is caused by SQL Server TCP/IP. In another article, I also found a solution.
How to solve the problem of JMeter accessing Oracle and MySQL through JDBC
Variable Name: You can enter an Oracle parameter, which will be explained later;
Database URL: jdbc: oracle: thin: @ {host_IP_or_machine_name }:{ port listened by the Oracle listener }:{ name of your Oracle instance} note that, {} braces are used for instructions. When configuring JMeter, remove {} braces ^_^.
JDBC Driver class: oracle. jdbc. driver. OracleDriver
Username: the user name used to access the preceding Oracle instance
Password: Password
Add a JDBC Request. The parameters to be modified include:
Variable Name: Enter the same content as the preceding JDBC Connection Configuration. This indicates that JDBC Connection Configuration creates a Connection pool named Oracle, and other JDBC requests will share the Connection pool;
Query: select * from table_name. We recommend that you open your data query tool and enter an SQL query statement to ensure that the result is displayed and then copy it;
Adds a View Results Tree;
Click Run to view the result. You can view the Response results on the Response data tab. Note:
The prompt is No Suitable Driver.
Search for the classes12.jar file on your computer and copy it to the Lib directory of JMeter. If you cannot find the classes12.jarfile, find the classes12.zip file and change the extension to jar;
ORA-00911: invalid character.
Make sure that the SQL statement you entered in the Query in the JDBC Request is correct.
How to Use the jdbc driver class when jdbc accesses the database
First, introduce the jar package corresponding to the database to the project. Otherwise, the class not found error is reported.
Oracle: Class. forName ("oracle. jdbc. driver. OracleDriver ");
Mysql: Class. forName ("com. mysql. jdbc. driver ");
Sqlserver: Class. forName ("com. microsoft. jdbc. sqlserver. SQLServerDriver ");