A Problem regarding connecting mysql connecter with intellij

159 views Asked by At

Ok, so I wanted to connect the MySQL connecter to intellij idea. I added the jar file to the module (also wrote requires mysql.connecter.java in the module.info file) and also added that jar file to the library. Here's the following code and under it, I wrote the issue I am having:

package sample;

import java.lang.Class;
import java.sql // And when I try to import java.sql, it shows me that I can't import it

public class DBConnection {

public static void main(String[] args) throws ClassNotFoundException {

    Class.forName("com.mysql.jdbc.Driver");
    // I can't import the Connection class and the DriverManager class
}
}

What am I doing wrong? Any help would be appreciated. Thank You!!

0

There are 0 answers