Home >Database >Mysql Tutorial >JDBC连接MySQL出现的问题_MySQL

JDBC连接MySQL出现的问题_MySQL

WBOY
WBOYOriginal
2016-06-01 13:20:40882browse

bitsCN.com 环境:

JDK 1.6.0_22+eclipse+MySQL5.0.22+mysql-connector-java-5.1.7-bin.jar



采用JDBC连接MySQL数据库,JDBC驱动已经添加到eclipse的项目“构建路径”里了,按理来说应该一切正常。运行项目后提示“无法加载驱动”。

最后解决的方法是,将mysql-connector-java-5.1.7-bin.jar放到"D:/Java/jdk1.6.0_22/jre/lib/ext”中,然后再编译运行上面的程序,就成功了。至于为什么,我还不知道。



貌似在“构建路径”中不加入驱动也可以,只要“%java_home%/jre/lib/ext”中有驱动就可以了。bitsCN.com

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn