我是新手,正在学习使程序连接到mysql数据库,但是有一个错误。我想知道如何查找url jdbc:mysql:
public class KoneksiDatabase {
private static Connection koneksi;
public static Connection getKoneksi(){
if (koneksi == null) {
try {
String url = "jdbc:mysql://localhost/universitas";
String user = "root";
String pasword = "kendo";
DriverManager.registerDriver (new com.mysql.jdbc.Driver());
koneksi = DriverManager.getConnection (url, user, pasword);
} catch (SQLException t) {
System.out.println ("Eror Java Database Connection");
}
}
return koneksi;
}
答案 0 :(得分:0)
您是否已将mysql-connector.jar文件添加到库中?它是默认java包中未包含的外部资源。