Answer the question
In order to leave comments, you need to log in
How to connect JDBC?
Help to connect the driver to work with mysql. Base class code
class App {
public static void main(String[] args) {
try {
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Driver loading success!");
}
catch(ClassNotFoundException e) {
e.printStackTrace();
}
}
}
javac App.java
java -cp mysql-connector-java-5.1.32-bin.jar App
Answer the question
In order to leave comments, you need to log in
The JVM cannot find the App.class file because in CLASSPATH you passed only Jar Mysql. Run like this:
java -cp .;mysql-connector-java-5.1.25-bin.jar App The
dot in the expression points to the current directory.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question