connecting database and java through jdbc

Answered

 Hi

I am new to IntelliJ. I was using the eclipse IDE before. I used the same code from eclipse which was working perfectly fine. but I get a lot of errors in IntelliJ.

I understood how to configure the database seperately from the help pages but I can't connect it through java. Do I have to add some jar file to project like in eclipse? If yes then please let me knoe the full procedure.

Errors:

Exception in thread "main" java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:292)
at JFXDB.JDBC1.main(JDBC1.java:14)

Process finished with exit code 1

 

Stephen

0
2 comments

Please use Java 8 for the project instead of Java 9.

Or you may need to configure the module-info for Java 9, see https://www.jetbrains.com/help/idea/getting-started-with-java-9-module-system.html and some other tutorials about Java 9 modules.

0
Avatar
Permanently deleted user

Thank you for the help.

0

Please sign in to leave a comment.