昨天把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。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持移动技术网。
如对本文有疑问, 点击进行留言回复!!
SpringBoot实现本地存储文件上传及提供HTTP访问服务的方法
Java实现AES/CBC/PKCS7Padding加解密的方法
SpringBoot整合Spring Security的详细教程
IDEA 非常重要的一些设置项(一连串的问题差点让我重新用回 Eclipse)
详解Springboot2.3集成Spring security 框架(原生集成)
网友评论