By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,197 Members | 1,207 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,197 IT Pros & Developers. It's quick & easy.

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

P: 1
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:

Expand|Select|Wrap|Line Numbers
  1. public TableCreator() throws SQLException {
  2.         host = "jdbc:mysql://localhost:3306/test";
  3.         dbName = "root";
  4.         dbPass = "pass";
  5.         conn = DriverManager.getConnection(host, dbName, dbPass);
  6.         query = conn.createStatement();
  7.         initialise();
  8.         System.out.println("Success.");
  9.     }
  10.  
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!
Jul 9 '15 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.