在使用JDBC连接Mysql数据库,向Mysql数据库插入一条带有中文的记录,在查询的时候,发现全都是??????

查询了一些资料,最简单的解决办法如下:
①:设置当前库的编码
ALTER DATABASE zhongfucheng
CHARACTER SET utf8;
②:设置当前表的编码
ALTER TABLE customer
CHARACTER SET utf8;
③:使用JDBC连接数据库时,指定编码
jdbc:mysql://localhost:3306/zhongfucheng?characterEncoding=utf8
当我们完成这三个步骤的时候,再插入数据:

<script type="text/javascript">
$(function () {
$('pre.prettyprint code').each(function () {
var lines = $(this).text().split('\n').length;
var $numbering = $('<ul/>').addClass('pre-numbering').hide();
$(this).addClass('has-numbering').parent().append($numbering);
for (i = 1; i <= lines; i++) {
$numbering.append($('<li/>').text(i));
};
$numbering.fadeIn(1700);
});
});
</script>