学习日记

正在关注 Linux 、开源的个人博客。

首页 | 留言本 | 标签云 | 网站地图 | 美味书签 | Learning Diary | 登录 |

ant初始化数据库的问题

2005年12月22日 上午 11:12 | 作者:littlebat

如果数据库是utf-8编码,用下面的初始化数据库任务会出错:

<target name=”initdb” >

<sql driver=”com.mysql.jdbc.Driver”

url=”jdbc:mysql://localhost:3306/learndiarydb”

userid=”dbuser”

password=”1234″

classpath=”lib/mysql-connector-java-3.1.12-bin.jar”

autocommit=”true”

rdbms=”mysql”

print=”true”

src=”database/testdata_mysql.sql” />

</target>

错误报告为:

Buildfile: build.xml

initdb:

      [sql] Executing file: F:\learndiary\learndiary\old\database\testdata_mysql.sql

      [sql] 0 rows affected

      [sql] Failed to execute:    INSERT INTO article VALUES (1,1,0,’鍏憡鐗?,’鍏憡鐗?,’2004-09-28 08:38:54′,”,1,’2005-11-10 08:27:50′,6,1,’admin’,1)

BUILD FAILED

F:\learndiary\learndiary\old\build.xml:124: java.sql.SQLException: Syntax error or access violation,  message from server: “You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘閸忣剙鎲¢悧锟?,’2004-09-28 08:38:54′,”,1,’2005-11-10 08:27:50″

Total time: 12 seconds

而这个初始化通过mysql的source learndiarydb yourpath\testdata_mysql.sql的命令来进行则不会出错。

不知是什么原因?

版权所有。转载时必须以链接形式注明作者和原始出处及本声明。

相关日记

随机日记

添加到网摘

[del.icio.us]  [新浪 VIVI]  [365key]  [YouNote]  [博采中心]  [Poco]  [SOHU狐摘]  [天极网摘]  [和讯网摘] 

发表评论

*必填

*必填 (不会被公开)


Copyright © 2004-2008 www.learndiary.com(学习日记)
Powered by WordPress with theme by UCDCHINA for Blogool come from JunChen Wu, nowa
联系版主:mdx-xx at tom dot com。2004.7.25