Problems with configuring database connections in the SSM framework

Source: Internet
Author: User

MySQL database version is 8.0.11.

To use the drive: Com.mysql.cj.jdbc.Driver

The most important is the connection URL of the database.

After a long day to understand the problem:

Add parameters after the database URL:

Jdbc:mysql://localhost:3306/taobao?characterencoding=utf-8&servertimezone=utc& Usessl=false

In addition, the configuration and XML configuration in the properties file should be noted: connection symbols:

Config in XML: need to use escape character:& instead of &

 <  bean  id  = "DataSource"   class  = "Com.alibaba.druid.pool.DruidDataSource"   Destroy-method  = "Close"         >  <  property  name  = "url"   value  = "Jdbc:mysql://localhost:3306/taobao?characterencoding=utf-8   &amp;    SERVERTIMEZONE=UTC  &amp;Usessl=false " />        < Propertyname= "username"value= "root" />        < Propertyname= "Password"value= "AAAAAA" />        < Propertyname= "Driverclassname"value= "Com.mysql.cj.jdbc.Driver" />        < Propertyname= "Maxactive"value= "Ten" />        < Propertyname= "Minidle"value= "5" />    </Bean>

In the properties, you cannot use the escape character and use:& directly

Jdbc.driver=com.mysql.cj.jdbc.driverjdbc.url=jdbc:mysql://localhost:3306/taobao?characterencoding=utf-8   &servertimezone=utc&UseSSL=falsejdbc.username=rootjdbc.password= AAAAAA

I've been wasting my time!

Problems with configuring database connections in the SSM framework

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.