Not sure if I have posted this topic in the correct part of the forum or whether I should've followed another topic but I couldn't seem to find the solution to my problem.
Apologies if I have posted incorrectly.
I have written the following program:
import java.sql.*;
public class MysqlConnect{
public static void main(String[] args) {
System.out.println("MySQL Connect Example.");
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";
String dbName = "dumal";
String driver = "com.mysql.jdbc.Driver";
String userName = "u551460";
String password = "dumal";
try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,userName,password);
System.out.println("Connected to the database");
conn.close();
System.out.println("Disconnected from database");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Basically I'm doing a small test to see if my java application will connect to a mysql database that I have set up.
I have already set the PATH variable to the JDBC connector but I still continue to get this message - I can't seem to find a way around it...
Any help would be greatly appreciated!
Apologies if I have posted incorrectly.
I have written the following program:
import java.sql.*;
public class MysqlConnect{
public static void main(String[] args) {
System.out.println("MySQL Connect Example.");
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";
String dbName = "dumal";
String driver = "com.mysql.jdbc.Driver";
String userName = "u551460";
String password = "dumal";
try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,userName,password);
System.out.println("Connected to the database");
conn.close();
System.out.println("Disconnected from database");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Basically I'm doing a small test to see if my java application will connect to a mysql database that I have set up.
I have already set the PATH variable to the JDBC connector but I still continue to get this message - I can't seem to find a way around it...
Any help would be greatly appreciated!