So i have done a bunch of java programming but this is my first time using a database in an application.
I am using intellij and MySQL
Now i made a simple application to store a random word. The computer i made this application on works perfectly. i can type a word, click save, close the program and the word will reappear the next time i run the program.
However, using this program on another computer i will get the following error
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
How do i make this program work on any other computer
here is some of the code to connect to the database
public class ConnectionConfiguration {
public static Connection getConnection() {
Connection connection = null;
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/testDatabase", "root", "qwerty");
} catch (Exception e) {
e.printStackTrace();
}
return connection;
}
}
Thanks!