why do my Connection code no longer working? I've everything right password,user, and also the host and also the driver but why do no longer working??

 import java.sql.*;

public class Connection {

    public  String url = "jdbc:mysql://localhost:3306/Testdb";
    public String driver = "com.mysql.jdbc.Driver";
    public String user = "root";
    public String pass = "123192";

    public void JdbcConnection(){

        try{
            Class.forName(driver);
        }catch(Exception e){
            e.printStackTrace();
        }

        try{
            Connection con = DriverManager.getConnection(url,user,pass);
        }catch(Exception e){
            e.printStackTrace();
        }
    }
}

However , "Connection con" ought to be of type java.sql.Connection, consider your personal class is known as Connection, your code thinks you're making a mention of the that rather than java.sql.Connection. You are able to disambiguate the kind of con using the full class title like so:

try{
    java.sql.Connection con = DriverManager.getConnection(url,user,pass);
}catch(Exception e){
    e.printStackTrace();
}

Please alter the title of the class (it mustn't a Connection particularly when you import the java.sql.*) and you have to specify the account information while acquiring an association.

public class TestConnection {
   ....
   Connection con = DriverManager.getConnection(url,user,pass);
}