Getting the following error - No suitable driver found for jdbc:postgresql://localhost: 5432/testDBMS

前端 未结 4 1070
野趣味
野趣味 2021-01-29 13:07

I get back an error indicating java.sql.SQLException: No suitable driver found for
jdbc:postgresql://localhost: 5432/testDBMS

import java.sql.*;
impo         


        
4条回答
  •  独厮守ぢ
    2021-01-29 14:08

    As the error says java -cp . JdbcPostgresqlConnection java.sql.SQLException: 
    No suitable driver found for jdbc:postgresql://localhost: 5432/testDBMS
    

    Which means you didnot include the postgresql.jar in your classpath

    Try executing like this and I'm assuming it is Windows OS by seeing your error

    java -cp .;pathOfYourDriverjar/postgresql.jar JdbcPostgresqlConnection
    

提交回复
热议问题