[enter image description here][1]while installing mysql on pc, i got an error message that "port 3306 is currently in use. provide another port" so i changed the port number to 3305. now i am trying to connect java project in netbeans ide to mysql, but it ain't working even though i tried with both the port numbers.
enter code here
String pword= password.getText();
String name= tf.getText();
String str= null;
Statement stmt= null;
ResultSet rs= null;
Connection conn=null;
try{
Class.forName("java.sql.Driver");
String pwd= "mysql";
String uid="root";
String url="jdbc:mysql://localhost:3306/project";
try{
conn= (Connection)DriverManager.getConnection(url,uid,pwd);
stmt= conn.createStatement();
String sql= "SELECT * FROM login WHERE name='" + name+ "'";
rs= stmt.executeQuery(sql);
rs.next();
str= rs.getString("password");
if(str.equals(pword))
{
menu m= new menu();
m.setVisible(true);
this.setVisible(false);
}
else
JOptionPane.showMessageDialog(null, "Incorrect username or password!");
rs.close();
stmt.close();
conn.close();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, "Incorrect username or password!");
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, "Error in Connectivity");
}