Answer the question
In order to leave comments, you need to log in
Can't fix error with jdbs Driver posgresql?
I just want to connect to postgresql but it gives an error
java.sql.SQLException: No suitable driver found for jdbs:postgresql://localhost:5432/postgres
here is the code
package com.company;
import java.sql.*;
public class Main{
public static void main(String[] args){
try{
Connection conn=DriverManager.getConnection("jdbs:postgresql://localhost:5432/postgres","posgres","42661902");
Statement st=conn.createStatement();
ResultSet rs=st.executeQuery("select * from countries");
while(rs.next()){
System.out.println(rs.getString("contry_id")+", "+rs.getString("country_name"));
}
}
catch (Exception e){
System.out.print(e);
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question