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

前端 未结 4 1096
野趣味
野趣味 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:07

    The syntax to compile was - java -cp .;"C:\Program Files\PostgreSQL\9.3\lib\postgresql-9.3-1102.jdbc4.jar" JdbcPostgresqlConnection. Note 2 things; the quotes around the jar specification and the jar files cannot be in a folder with a space in the name. This is normally not the case on *nix system, but is often encountered in Windows systems. Note too, that when I put the jar file in the same folder with the java program I could eliminate the double quotes - java -cp .;C:\AZ_Fantasy5\postgresql-9.3-1102.jdbc4.jar JdbcPostgresqlConnection. Special thanks to JB Nizet for pointing out this situation.

提交回复
热议问题