找不到 Jdbc 驱动程序

2021-12-21 00:00:00 exception driver mysql netbeans jdbc

我们正在使用 Java 在 netbeans 中开发一个项目,该项目使用 mysql 数据库来处理一些常见查询.但是我在 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 similar for an Oracle database, for example (you would have to add the ojdbc6.jar).

对于 MySQL,您必须获取 MySQL JDBC 连接器并将其添加到项目的类路径中.

For MySQL, you have to get the MySQL JDBC connector and add it to your project's classpath.

  • 在 MySQL 站点上获取 MySQL JDBC 连接器,或者通过 Maven 依赖项添加它(如果您的项目由 Maven 驱动),请检查 MySQL 官方网站.截至 2012 年 5 月的当前版本为 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. The current version as of 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

相关文章