hibernate向Mysql导入数据全都是问号,求各位大神解决!

用的版本是 eclipse4.3.2 kepler + hibernate-release-4.2.4.Final +

hibernatetools-Update-4.1.2.Final_2014-03-18_15-46-19-B706

+Mysql6.0 + Navicat Premium

hibernate向Mysql导入数据全都是问号,求各位大神解决!_第1张图片

hibernate向Mysql导入数据全都是问号,求各位大神解决!_第2张图片

hibernate向Mysql导入数据全都是问号,求各位大神解决!_第3张图片

上图的第三条中文是我自己在Navicat中插入的,显示中文是正确的,用命令行显示中文也是正确显示中文的。

hibernate向Mysql导入数据全都是问号,求各位大神解决!_第4张图片

就是用hibernate插入数据会导致中文变成问号。

以下是我设置的编码

hibernate向Mysql导入数据全都是问号,求各位大神解决!_第5张图片

hibernate向Mysql导入数据全都是问号,求各位大神解决!_第6张图片


hibernate向Mysql导入数据全都是问号,求各位大神解决!_第7张图片

my.ini中的文件

hibernate向Mysql导入数据全都是问号,求各位大神解决!_第8张图片hibernate向Mysql导入数据全都是问号,求各位大神解决!_第9张图片

能设置的全都设置成UTF-8了。

最后再把Console输出的内容复制一下

六月 09, 2018 11:13:16 下午 org.hibernate.annotations.common.Version
INFO: HCANN000001: Hibernate Commons Annotations {4.0.2.Final}
六月 09, 2018 11:13:16 下午 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.2.4.Final}
六月 09, 2018 11:13:16 下午 org.hibernate.cfg.Environment
INFO: HHH000206: hibernate.properties not found
六月 09, 2018 11:13:16 下午 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
六月 09, 2018 11:13:16 下午 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
六月 09, 2018 11:13:16 下午 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
六月 09, 2018 11:13:16 下午 org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
六月 09, 2018 11:13:16 下午 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: Students.hbm.xml
六月 09, 2018 11:13:16 下午 org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
六月 09, 2018 11:13:16 下午 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
六月 09, 2018 11:13:16 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
六月 09, 2018 11:13:16 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20
六月 09, 2018 11:13:16 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
六月 09, 2018 11:13:16 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/hibernate?useUnicode=true&characterEncoding=UTF-8]
六月 09, 2018 11:13:16 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=root, password=****}
六月 09, 2018 11:13:17 下午 org.hibernate.dialect.Dialect
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
六月 09, 2018 11:13:17 下午 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
INFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
六月 09, 2018 11:13:17 下午 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
六月 09, 2018 11:13:17 下午 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory
INFO: HHH000397: Using ASTQueryTranslatorFactory
六月 09, 2018 11:13:17 下午 org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: HHH000227: Running hbm2ddl schema export

Hibernate: 
    drop table if exists STUDENTS
Hibernate: 
    create table STUDENTS (
        SID integer not null,
        SNAME varchar(255),
        GENDER varchar(255),
        BIRTHDAY datetime,
        ADDRESS varchar(255),
        primary key (SID)
    ) ENGINE=InnoDB
六月 09, 2018 11:13:17 下午 org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: HHH000230: Schema export complete

Hibernate: 
    insert 
    into
        STUDENTS
        (SNAME, GENDER, BIRTHDAY, ADDRESS, SID) 
    values
        (?, ?, ?, ?, ?)
Hibernate: 
    insert 
    into
        STUDENTS
        (SNAME, GENDER, BIRTHDAY, ADDRESS, SID) 
    values

        (?, ?, ?, ?, ?)

还有啥需要我补充的请尽管提出来。

你可能感兴趣的:(hibernate,hibernate,mysql,java)