Javaweb the same code, there is no problem testing locally, why is there a coding problem when it comes to data inventory on centos's server?

    <!-- 1.  : DriverManagerDataSource -->
    <bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://localhost:3306/ehouse" />
        <property name="username" value="root" />
        <property name="password" value="" />
    </bean>


is there a problem with this configuration?

Mar.03,2021

when using JDBC to connect to the Mysql database and insert a record with Chinese into the Mysql database, it is found that they are all?
here is a picture description
to query some information. The simplest solution is as follows:
1: set the encoding of the current database

ALTER DATABASE zhongfucheng
CHARACTER SET utf8;

2: set the encoding of the current table

ALTER TABLE customer
  CHARACTER SET utf8;

3: specify the encoding when using JDBC to connect to the database

jdbc:mysql://localhost:3306/zhongfucheng?characterEncoding=utf8

when we complete these three steps, insert the data again: that's it


it seems that you have not specified the encoding to be used when connecting to the database, so the default encoding of the system will be used, and the default encoding may be different between the two systems.

I guess your database code should be gbk?. Therefore, the coding of the local Chinese environment is the same as that of the database, while the default of centos may not be gbk.


No encoding was specified when configuring the database connection

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b8dc-2c28a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b8dc-2c28a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?