I'm very interested in programming but I'm new to the field and I need to deliver this work to the teacher. But I can not resolve this error.
package dal;
import java.sql.*;
import javax.swing.JOptionPane;
public class ConectaBd {
public static Connection conectabd() throws ClassNotFoundException, SQLException{
try{
Class.forName("org.postgresql.Driver");
Connection con = DriverManager.getConnection("jdbc:postgresql://localhost:5432","postgres","123");
JOptionPane.showMessageDialog(null, "Conecxão bem sucedida !");
return con;
}
catch(SQLException error){
JOptionPane.showMessageDialog(null, "Não foi possível conectar !");
return null;
}
}
}
This is the error:
May 22, 2017 10:19:47 PM org.postgresql.Driver connect GRAVE: Error in url: jdbc: postgresql: // localhost: 5432 STOP CONSTRUCTION (total time: 3 minutes 23 seconds)