Hello. There is a servlet in which I try to connect to the DB. Here is the code.
try { this.getClass().getClassLoader().loadClass("org.postgresql.Driver");} catch (ClassNotFoundException e) {e.printStackTrace();} try { connection = DriverManager.getConnection("jdbc: postgresql://127.0.0.1:5432 ", "postgres","923506"); } catch (SQLException e) {e.printStackTrace();}
Gives an error message
java.sql.SQLException: No suitable driver found for jdbc: postgresql: //127.0.0.1: 5432
A little background and description of the current settings.
- A bunch of the current version of the database and jdbc driver works on ordinary (not web applications).
- The jar jdbc driver file is in% CATALINA_HOME% / lib. In the project, this file is specified in this directory (before that, it was lying elsewhere and the error occurred even at the time the class was loaded, then an error was issued at the time of connecting to the database).
Attention, the question: What is wrong here?