当前位置: 移动技术网 > IT编程>开发语言>Java > Jmeter连接Mysql数据库实现过程详解

Jmeter连接Mysql数据库实现过程详解

2020年08月15日  | 移动技术网IT编程  | 我要评论

昨天把mysql装好了,这个躺在草稿中很久的文章也可以出炉了。

首先需要准备个mysql jdbc驱动包,尽量保证其版本和你的数据库版本一致,至少不低于数据库版本,否则可能有问题。去官网扒一个下来吧:

1、测试计划(test plan)下面把jdbc驱动包导入。

2、线程组下添加一个配置元件jdbc connection configuration。

variable name:自定义参数,在jdbc request中会用到;

database url:jdbc:mysql:// 数据库ip地址:数据库端口/数据库名称;

jdbc driver class:com.mysql.jdbc.driver;

username:数据库用户名;

password:数据库密码;

3、在添加一个sampler:jdbc request,顺手加个结果树。

--------------------------------------分割线---------------------------------------

上述过程中,执行之后结果树中出现了一个报错:

java.sql.sqlexception: cannot create poolableconnectionfactory (the server time zone value 'öð¹ú±ê׼걼ä' is unrecognized or represents more than one time zone. you must configure either the server or jdbc driver (via the servertimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.)

解决如下:

在database url后面加上?servertimezone=utc,其中utc是统一标准世界时间。

解决中文乱码输入问题,可以在database url后面加上?useunicode=true&characterencoding=utf-8。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持移动技术网。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网