首页 > 解决方案 > 连接到netbeans的数据库

问题描述

我已经使用 EasyPHP 创建了一个数据库,但后来我发现我可以直接在 NetBeans 8.2 上创建我的数据库。我创建的数据库有点太大:重新创建它需要一些时间。我没有设法将它导入到 NetBeans 的数据库中,而且我很难连接到 NetBeans 上的任何数据库。我想知道如何将它导入 NetBeans 的数据库,它是否与我在 EasyPHP 中使用的代码(下面的代码)相同,或者我应该更改什么?

try {
    Class.forName("com.mysql.jdbc.Driver");

} catch (ClassNotFoundException e) {
    new NotificationBuilder().withStyle(new DarkDefaultNotification()).withTitle("erreur")
    .withMessage("Erreur au niveau du driver").withDisplayTime(3000).showNotification();
}
try {
    con= DriverManager.getConnection(url,name,pwd);

} catch (SQLException e) {
    new NotificationBuilder().withStyle(new DarkDefaultNotification()).withTitle("erreur 2")
    .withMessage("erreur d'etablissement de connexion").withDisplayTime(3000).showNotification();

}

标签: javadatabasenetbeans-8

解决方案


推荐阅读