Jmeter (8)-JDBC request (sqlserver)

Source: Internet
Author: User

To make a JDBC request, first understand what the JDBC object is, and then look for the response database connection URL and database driver.

Database URL: jdbc: sqlserver: // 200.99.197.190: 1433; databaseName = ebank

Database DRIVER: com. microsoft. sqlserver. jdbc. SQLServerDriver

Download sqljdbc4.jar and place it under apache-jmeter-2.6 \ lib

Sqlserver driver package (jar) Name:

Microsoft‑sql‑server‑jdbc‑driver=3.0sqljdbc_3.0.1301.101_chs.exe

-- Download and decompress the sqljdbc4.jar in the apache-jmeter-2.6 \ lib under

The method I use is to specify the driver class by connecting to the database, and some people use the Driver Class in the JTDS open-source community,Corresponding to different driver classesJarDifferent.

 

Connect to the specified Driver Class of the database (you can download the standard sqlserver driver)

ClassName = "com. microsoft. jdbc. sqlserver. SQLServerDriver ";

Access Database Url = "jdbc: microsoft: sqlserver: // localhost: 1433; DatabaseName = db_JXC; SelectMethod = Cursor ";

 

Driver Class in the JTDS open-source community (I don't know where to download it, 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/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"

The above table lists the collected database driver classes and URL formats.

Add the JDBC default connection request, that is, the connection information of MS SQL: Database URL (Different driver classes have different connection strings.), MSSQL Driver Class, database username and password.

Add a JDBC request. Here is the Stored Procedure statement that I executed. Parameterization is used in the statement.

Parameterization is performed using the jmeter control, and no function assistant is used.

Assertions are also used in this script, because the JDBC request (Stored Procedure) has an SQL return value. If the return value is 1, the stored procedure is successfully executed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.