I\'m new in Java, and I need to establish a connection to a MySQL server (local), I have add the libraries in Intellij idea but it seems not work, the IDE can\'t find the cl
It's easy to configure first just open the InteliJ IDE and follow this simple step
File->Project Structure->Libraries
Then Click on the plus(+) sign and select From Meven....
After you'll get a search box there you should put
mysql:mysql-connector-java:5.1.40
This will solve the issue
Solution#1:Drop the mysql-connector-java-version-bin.jar file to your project, right click on it, select "Add as library".
Solution#2:Build and run with command line, for example(Windows)
You have to add 'mysql:mysql-connector-java:5.1.40' from maven or add it as java library as shown:
If it says time zone unrecognized you can add this piece of code to the URL:
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost?useTimezone=true&serverTimezone=UTC","USER-NAME","PASSWORD");
Don't forget to wrap it with a try-catch.