您还可以使用编码创建数据库。
只需
phpMyAdmin用于数据库/表创建。
您可以在hibernate设置的URL中指定一些URL参数,以使用UTF8建立连接:
<!-- Database Settings --><property name="connection.driver_class">com.mysql.jdbc.Driver</property><!-- for performance reasons changed to MyISAM from org.hibernate.dialect.MySQLInnoDBDialect --><property name="dialect">org.openmeetings.app.hibernate.utils.MySQL5MyISAMDialect</property><property name="connection.url">jdbc:mysql://localhost/openmeetings?autoReconnect=true&useUnipre=true&createDatabaseIfNotExist=true&characterEncoding=utf-8</property><property name="hibernate.connection.CharSet">utf8</property><property name="hibernate.connection.characterEncoding">utf8</property><property name="hibernate.connection.useUnipre">true</property>
您无需将数据库中的整个编码设置为utf8,仅当您使用
<!-- Database Scheme Auto Update --><property name="hbm2ddl.auto">update</property>
您将必须将MySQL的默认编码设置为utf8。因为
hbm2dll将会使用数据库的默认编码。
您可能仍会使用
hbm2ddl.auto,并手动修改数据库的表以具有utf8排序规则。
如果您没有使用
hbm2ddl.auto,则可以使用您喜欢的编码来简单地创建表。无需将数据库设置为特殊编码。
塞巴斯蒂安



