java.sql.SQLException: No suitable driver found (Intellij IDEA, XAMPP)

已回答

Hey there,
I've a little problem with the error java.sql.SQLException: No suitable driver found for [...]. The pictures below show the error and the Settings around the Driver. I've watched so many Youtube videos but everybody says something different where the connection driver has to be put in. Can you help me in this situation? I also read the posts here, but also they didn't help me. Im Using IntelliJ IDEA 2022.1 on Windows. My Database runs on XAMPP.  

My Code:

import java.sql.*;

public class demo {

public static void main(String[] args) {

try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc.mysql://localhost:3307/bier", "root", "root");


Statement stat = con.createStatement();
ResultSet rs = stat.executeQuery("SELECT * FROM `biertabelle` ORDER BY `biertabelle`.`Marke` ASC");
while (rs.next())
System.out.println(rs.getString("Marke"));
con.close();
} catch (Exception e) {
System.out.println(e);
}
}
}

The error:

My Configuration:

Thanks for Help! 

评论操作 固定链接

The specified URL seems incorrect. Please see if https://stackoverflow.com/a/5983038/12844632 helps.

0
评论操作 固定链接

Hi, thaks for help. Now this Error is gone but a new is here

java.sql.SQLSyntaxErrorException: Unknown database 'bier'

any Idea?

0
评论操作 固定链接

Your SQL Server does not have a database loaded called "bier". Please double check your MySQL server settings and the URL.

0

请先登录再写评论。