Skip to content

Commit cb64e82

Browse files
committed
add error message
1 parent 3d867ad commit cb64e82

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/com/supinfo/database/DbManager.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.supinfo.entities.Employee;
1010
import com.supinfo.entities.Manager;
1111
import com.supinfo.entities.Todo;
12+
1213
import java.sql.Connection;
1314
import java.sql.Statement;
1415
import java.sql.DriverManager;
@@ -20,6 +21,8 @@
2021
import java.util.logging.Level;
2122
import java.util.logging.Logger;
2223

24+
import javax.swing.JOptionPane;
25+
2326
/**
2427
*
2528
* @author Aztyu
@@ -35,8 +38,10 @@ public static void openConnection(){
3538
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/projetjava", "root", "root");
3639
} catch (ClassNotFoundException ex) {
3740
System.out.println("No class found");
41+
JOptionPane.showMessageDialog(null, "No driver found : " + ex.getMessage());
3842
} catch (SQLException ex) {
3943
System.out.println("Open connection error : " + ex.getMessage());
44+
JOptionPane.showMessageDialog(null, "Open connection error : " + ex.getMessage());
4045
}
4146
}
4247

@@ -46,10 +51,12 @@ public static Connection createConnection(){
4651
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/projetjava", "root", "root");
4752
return conn;
4853
} catch (ClassNotFoundException ex) {
54+
JOptionPane.showMessageDialog(null, "No driver found : " + ex.getMessage());
4955
System.out.println("No class found");
5056
return null;
5157
} catch (SQLException ex) {
5258
System.out.println("Open connection error : " + ex.getMessage());
59+
JOptionPane.showMessageDialog(null, "Open connection error : " + ex.getMessage());
5360
return null;
5461
}
5562
}

0 commit comments

Comments
 (0)