Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Crear connexió amb la base de dades
- private boolean beginConnection() {
- boolean result = true;
- if (connected) {
- System.err.println("ERROR: Ja estàs connectat a la base de dades");
- result = false;
- } else {
- try {
- connection = DriverManager.getConnection("jdbc:postgresql://localhost:" + port + "/" + DB_NAME, username, password);
- System.out.println("SUCCESS: Connexió establerta");
- connected = true;
- } catch (SQLException e) {
- System.err.println("ERROR: No s'ha pogut establir la connexió amb la base de dades");
- //e.printStackTrace();
- result = false;
- }
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement