Java in Eclipse - MySQL Non Registering Driver when connecting to database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rob9021
    New Member
    • Jul 2015
    • 1

    Java in Eclipse - MySQL Non Registering Driver when connecting to database

    Hi Guys,

    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:

    Code:
    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.g etConnection(ho st, dbName, dbPass);'.

    The stack looks like this just after I have attempted to execute this line:

    TableCreator (1) [Java Application]
    biz.cogitare.gp sperformancetoo l.TableCreator at localhost:53389
    Thread [main] (Suspended)
    Driver(NonRegis teringDriver).c onnect(String, Properties) line: 306
    DriverManager.g etConnection(St ring, Properties, Class<?>) line: not available
    DriverManager.g etConnection(St ring, String, String) line: not available
    TableCreator.<i nit>() line: 23
    TableCreator.ma in(String[]) line: 49
    Daemon Thread [Abandoned connection cleanup thread] (Running)
    C:\Program Files\Java\jre1 .8.0_45\bin\jav aw.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!
    Last edited by Rabbit; Jul 9 '15, 03:50 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
Working...