找不到Jdbc驱动 [英] Jdbc Driver Not Found
问题描述
我们正在使用Java使用mysql数据库处理一些常见查询的netbeans中的一个项目。但是我在netbeans中为mysql加载jdbc驱动程序有问题。它提供以下错误:
We are working on a project in netbeans using Java which uses mysql database to process some common queries. But I am having issues with loading jdbc drivers for mysql in netbeans. It is giving following error:
找不到类异常:com.jdbc.mysql.Driver
请帮助我。
Class Not Found Exception : com.jdbc.mysql.Driver please help me out.
推荐答案
您只需将mysql JDBC连接器添加到您的项目中即可。对于Oracle数据库来说,这将是一样的(你必须添加ojdbc6.jar)。
You just have to add the mysql JDBC connector to your project. It would be the same for an Oracle database, for example (you would have to add the ojdbc6.jar).
所以关于MySQL你必须得到MySQL JDBC连接器并将其添加到您的类路径项目中。
So about MySQL you have to get the MySQL JDBC connector and add it to your classpath project.
- 获取MySQL JDBC连接器,无论是在MySQL站点上,还是通过Maven依赖关系如果您的项目由Maven驱动),请查看官方MySQL站点。在2012年的当前版本是5.1.19(适用于任何版本的MySQL);
- 将其添加到您的Netbeans类路径,在项目属性中。检查有关项目类路径的在线Netbeans配置(如果需要)
- get the MySQL JDBC connector, either on the MySQL site, either adding it through a Maven dependency (if your project is driven by Maven), check the official MySQL site. Current version in may 2012 is 5.1.19 (works with any version of MySQL) ;
- add it to your Netbeans classpath, in the project properties. Check the online Netbeans configuration about project classpath if needed
这篇关于找不到Jdbc驱动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!