So I\'m having an issue connecting to MySQL with Java. Heres my code:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException
Are you sure that the DB server is not case sensitive? I mean maybe on the DB server the DB name is WorldDb and you are trying to connect to it by using worlddb (all low lecters).. Try to use the same name or to configure MySQL to be case insensitive
Make sure that the database what you have mentioned in Host = "jdbc:mysql://localhost/worlddb";
i.e worlddb is correct or not.
The name of the database here is CASE SENSITIVE! So, if you try to connect using a database name like "test2" instead of "Test2" , you will get the
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'test2'
Also try using port number too
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/worlddb", "root", "password");
Write
"jdbc:mysql://localhost:3306/worlddb"
instead of
"jdbc:mysql://localhost/worlddb"