Home > Back-end >  The correct Java beginners mysql8 database to connect to the database
The correct Java beginners mysql8 database to connect to the database

Time:09-28

Is a simple program debugging for two days, or even not on database, always report a big wrong, strives for the big help, thank you very much!!!!!!


Error message: the Exception in the thread "is the main" Java. Lang. ClassNotFoundException: com. Mysql. Cj). The JDBC driver
The at Java. The base/JDK. Internal. Loader. BuiltinClassLoader. LoadClass (BuiltinClassLoader. Java: 583)
The at Java. The base/JDK. Internal. Loader. ClassLoaders $AppClassLoader. LoadClass (ClassLoaders. Java: 178)
The at Java. The base/Java. Lang. This. LoadClass (521). This Java:
The at Java. The base/Java. Lang. Class. ForName0 (Native Method)
The at Java. The base/Java. Lang. Class.forname (332) Class. Java:
At com. Max. JDBC. Conn. ConnectionClass. Main (ConnectionClass. Java: 8)

CodePudding user response:

Com. Mysql. Cj, the JDBC driver to com. Mysql. Cj). The JDBC driver
Capitalize the name of the class, more careful

CodePudding user response:

The Exception in the thread "main" Java. Lang. ClassNotFoundException: com. Mysql. Cj). The JDBC driver

Write clearly for you, can not find this kind of com. Mysql. Cj). The JDBC driver

Then you went to see the class...

And then found the first letter no capital

CodePudding user response:

refer to the original poster Dreamypurple response:
is a simple program debugging for two days, or even not on database, always report a big wrong, strives for the big help, thank you very much!!!!!!


2, as the name of the class to write a and upstairs said wrong, as well as to add time zones,

String DB_DRIVER=". Com. Mysql. Cj. JDBC Driver ".
String DB_URL="JDBC: mysql://localhost: 3306? ServerTimezone=Asia/Shanghai ";
  • Related