import java.sql.*;
public class a2 {
public static void main(String[] args) {
try{
Connection con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/univ_db", "postgre", "astronaut.pd");
PreparedStatement pstmt = con.prepareStatement("select id from student");
ResultSet Rs = pstmt.executeQuery();
while(Rs.next()){
System.out.println(Rs.getInt(5));
}
}catch(Exception ex){
System.out.println(ex.getMessage());
}}}
I am trying to connect my server with my databse, and I do not know what i did wrong on this. I tried to search it online but I did not find any solution.
Error:
No suitable driver found for jdbc:postgresql://localhost:5432/univ_db