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
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");