This is my first post so if I get anything wrong I apologise!
I am using Java in Eclipse to create tables in a MySQL Database. Everything has been working fine until it inexplicably stopped working the other day. My code runs but nothing happens to the database due to an error when I try to initialise the connection. The code actually runs to the end, the error is only viewable when I step through the code.
This is the constructor of my TableCreator class:
public TableCreator() throws SQLException {
host = "jdbc:mysql://localhost:3306/test";
dbName = "root";
dbPass = "pass";
conn = DriverManager.getConnection(host, dbName, dbPass);
query = conn.createStatement();
initialise();
System.out.println("Success.");
}
The error occurs on the line 'conn = DriverManager.getConnection(host, dbName, dbPass);'.
The stack looks like this just after I have attempted to execute this line:
TableCreator (1) [Java Application]
biz.cogitare.gpsperformancetool.TableCreator at localhost:53389
Thread [main] (Suspended)
Driver(NonRegisteringDriver).connect(String, Properties) line: 306
DriverManager.getConnection(String, Properties, Class<?>) line: not available
DriverManager.getConnection(String, String, String) line: not available
TableCreator.<init>() line: 23
TableCreator.main(String[]) line: 49
Daemon Thread [Abandoned connection cleanup thread] (Running)
C:\Program Files\Java\jre1.8.0_45\bin\javaw.exe (9 Jul 2015 12:27:27)
I have spent many hours searching the internet for help on how to fix this but so far I have been unsuccessful.
Any help would be greatly appreciated.
Thanks!