-1

the exception indicates that the driver is unknown while it exists in the lib of the web-inf directory.

any help please? JDB driver problem

1 Answers1

1

Use

Class.forName ("com.mysql.jdbc.Driver");

instead of

Class.forName ("com.sql.jdbc.Driver");

However I would recommend to use a DataSource in java EE (see https://tomcat.apache.org/tomcat-8.5-doc/jdbc-pool.html)

Maksim
  • 511
  • 5
  • 15
  • it works Maksim, thank you. but i obtained another exception about the time zone.. – Constellation Nov 18 '18 at 18:33
  • Which type of exception ? Can you share it and post some code ? – Maksim Nov 18 '18 at 18:36
  • "java.sql.SQLException: The server time zone value 'Paris, Madrid' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support." – Constellation Nov 18 '18 at 18:37
  • Unfortunately the connect string is not viewable in your screenshot (therefore I just can guess) but probably you should replace the setting of serverTimezone to `&serverTimezone=Europe/Paris` – Maksim Nov 18 '18 at 18:51
  • the connection instruction are as below "Class.forName("com.mysql.jdbc.Driver"); connection=DriverManager.getConnection("jdbc:mysql://localhost:3306/ma_base", "root", "admin");" Where did i have to add "&serverTimezone=Europe/Paris"? thank you in advance – Constellation Nov 18 '18 at 18:55
  • Try this: `DriverManager.getConnection("jdbc:mysql://localhost:3306/ma_base?serverTimezone=Europe/Paris", "root", "admin")`. However it seems like your mysqld is misconfigured.... – Maksim Nov 18 '18 at 19:11
  • the only error message that still appear is "Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary" otherwise all others are OK !! – Constellation Nov 18 '18 at 19:21
  • Then you know what to do. Congrats. :-) – Maksim Nov 18 '18 at 19:25
  • 1
    yes, all works perfectly, thank you a lot Maksim, you are a Great person !! – Constellation Nov 18 '18 at 19:29