配置shark与mysql的连接
2008-01-05 18:43:09 来源:WEB开发网为了把DB换为MySQL的,我执行了如下步骤:
1.修改configure.PRoperties文件中的
# database vendor, pick one of:
# db2, hsql, informix, msql, mysql, Oracle, postgresql, sybase
db_loader_job=mysql
# user credentials for DB access
db_user=root
db_passwd=
2.copy mysql的jdbc driver jar文件到lib\contrib\下。
3.在mysql中建立名为shark的Database。
4:运行conigure.bat出现以下错误
Buildfile: configure.xml
init:
_copyNfilter:
[copy] Copying 35 files to C:\Shark-1.0
_winFileSeparator:
[replace] Replaced 19 occurrences in 2 files.
[delete] Deleting 11 files from C:\Shark-1.0
_linFileSeparator:
_recreateDB:
[delete] Deleting Directory C:\Shark-1.0\db\hsql
[delete] Deleting directory C:\Shark-1.0\repository\internal\history
[delete] Deleting directory C:\Shark-1.0\repository\internal
[mkdir] Created dir: C:\Shark-1.0\db\hsql
[mkdir] Created dir: C:\Shark-1.0\repository\internal\history
[java] Default (Standard) Logger is load.
[java] application is started.
[java] Loader loads XML file : conf/sql/mysql/LoaderJob.olj
[java] XML document is valid.
[java] Import job No. 1 is started.
BUILD FAILED
file:C:/Shark-1.0/configure.xml:124: Java returned: 1
Total time: 9 seconds
6:将configure.bat 中mysql_Connection_Url=jdbc:mysql://localhost/shark
改成mysql_Connection_Url=jdbc:mysql://localhost:3306/shark
还是出现一样的错误
7:将configure.xml第157行改为
<filter token="DB_URL" value="${db_url}"/>
还是出现一样的错误
后来感觉应该是驱动有问题,于是到http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-3.0.15-ga.zip/from/pick 去重新下载一个解开,将其中的mysql-connector-java-3.0.15-ga-bin.jar放进lib\contrib目录下
再次运行configure.bat 。这次运行成功。
错误原因:粗心将mysql 的 mm.mysql.jdbc-2.0pre5 里面驱动放进去lib里去了。
更多精彩
赞助商链接