-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoot.java
More file actions
34 lines (30 loc) · 1.02 KB
/
Root.java
File metadata and controls
34 lines (30 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import javax.swing.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Root extends JFrame{
private JLabel wlcm, who;
private JButton manager, customer, animator;
private static Connection connection;
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run(){
Start_screen strt = new Start_screen();
strt.setVisible(true);
}
});
String url = "jdbc:postgresql://localhost:5432/vacation_village";
String username = "postgres";
String password = "boraberk";
try {
connection = DriverManager.getConnection(url, username, password);
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Not connected to database","ERROR",JOptionPane.ERROR_MESSAGE);
ex.printStackTrace();
}
}
public Connection getConnection() {
return connection;
}
}