my dog learned polymorphism*
The moose likes JDBC and the fly likes Eclipse + MySQL: Mountain Lion problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Eclipse + MySQL: Mountain Lion problem" Watch "Eclipse + MySQL: Mountain Lion problem" New topic

Eclipse + MySQL: Mountain Lion problem

Maeve Duffy

Joined: Feb 12, 2013
Posts: 3
I've searched every board I can think of (5+ days now) and still cannot find an answer. Help!

I'm not new to Java, or Eclipse, or MySQL, but I am new to OS X Mountain Lion. My husband upgraded my MacBook (at my request) to Mountain Lion last week. With Snow Leopard, my program ran just fine. It connected to MySQL straight off, no problems at all.

Here's a code snippet:

String url = "jdbc:mysql://localhost:3306/CountyFair";
dbConnection = DriverManager.getConnection(url, MYSQL_USER, MYSQL_PW);

And here is the error message:

sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'countyfair'

I can run mysql from the command line, with that user, that password, and that database just fine. No problems at all. The database DOES EXIST.

Since getting this error, I've upgraded to mysql 5.6.10, mysql-connector 5.1.23, and eclipse 4.2.1. None of that has helped. I've tried using the actual ip instead of localhost. I've tried creating a new user and granting all privileges on *.* and on countyfair.* to that user. No luck. Any ideas?
Maeve Duffy

Joined: Feb 12, 2013
Posts: 3
Update: after installing dtp on Eclipse, I was able to connect in db development, but couldn't see any tables. Still couldn't connect from the program. I had turned the firewall off days ago but hadn't rebooted, so I did that and now I the program connects but can't see anything in the db. No tables, no stored procs, no views.
Maeve Duffy

Joined: Feb 12, 2013
Posts: 3
Fixed. Apparently rebooting after changing the security settings was the "real" answer. Who knew? That's not something I expect to have to do from a Mac. That's a windows hangup.

Also this post helped:
It is sorta covered in the JavaRanch Style Guide.
subject: Eclipse + MySQL: Mountain Lion problem
Similar Threads
Eclipse an MySQL
Setting up a database connection with Struts 2 and Tomcat 6.0
problem with jdbc driver
Basic instructions for setting up/running mySQL
MySQL Linux Administration Question