我有解决MYSQL连接的ClassNotFoundExcepton问题,找不到Netbeans的Libraries文件夹?

huangapple go评论60阅读模式
英文:

I have problem solving ClassNotFoundExcepton for MYSQL connectivity, Cannot find Libraries folder Netbeans?

问题

I'm sorry, but the content you provided is not directly related to the information in the user profile you shared earlier. The content seems to be about a MySQL connectivity issue in a Java application. If you have any questions or need assistance with the topic mentioned in the user profile, please let me know, and I'll be happy to help.

英文:

I am using MYSQL v8,Connector J8,Netbeans 12. Created very simple Maven java application to connect MySQL. I have added Connector8 to Classpath, I can run this program using CMD JDK works fine. Inside netbeans I used services tab added added driver; I also made connection to database there & I can see my database details in left panel. Still I keep getting

>java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/employeemanager?

Other solutions on stackoverflow inform me that I need to add .jar file to Library folder. I did not found library folder anywhere in project properties, theres no option to add jar in latest version. Please help me solving it.

答案1

得分: 0

我找到了答案!使用 Netbeans 12 IDE,我正在使用Maven创建项目。在 Maven项目 中找不到“Libraries”文件夹;它在 'Ant项目' 中可用。要向Maven项目添加外部Jar文件,您需要添加依赖项。

下面是向Netbeans Maven依赖项中添加MySQL驱动程序的步骤:

1.右键单击依赖文件夹,然后单击添加依赖项。
2.在ArtifactID中写入详细信息:mysql-connector-java,GroupId:mysql,
3.检查您的驱动程序版本并在版本框中输入类型,例如8.0.20。
4.单击“添加”按钮以添加此依赖项。

(可选:如果在添加/检测正确的Jar时出现错误)

5.现在,您可以看到您的驱动程序已自动添加在左侧,但带有警告标记。
6.右键单击驱动程序,然后选择“手动安装工件”。
7.提供到您的.jar驱动程序文件的路径。
完成!

英文:

I found the answer ! Using Netbeans 12 IDE, I was creating project using Maven. Libraries folder is not available in Maven Projects; Its available in 'Ant Projects'. For adding external Jar files in Maven projects you need to add Dependencies.

Here I have given below steps to add MySQL Driver to Netbeans Maven Dependency

  1. Right click on Dependency folder click add dependancy
  2. Write details as ArtifactID : mysql-connector-java, GroupId : mysql,
  3. Check your Driver version and type in version box. eg 8.0.20
  4. Click on 'Add' button to add this dependency

(Optional : if error occurs in adding/detecting corrrect Jar)

  1. Now you can see your driver automatically added in left, but caution mark.
  2. Right click driver and select 'Manual install artifact'
  3. Provide path to your .jar driver file.
    Done!

huangapple
  • 本文由 发表于 2020年7月31日 00:31:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/63177508.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定