PasswordFiled char[] to String in Java connection MySql?
- by user1819551
This is a jFrame to connect to the database and this is in the button connect. My issue is in the passwordField NetBeans make me do a char[], but my .getConnection not let me insert the char[]  ERROR: "no suitable method found for getConnection(String,String,char[])". So I will change to String right? So when I change and run the jFrame said access denied. when I start doing the System.out.println(l) " Give me the right answer" Like this: "Alex". But when I do the System.out.println(password) "Give me the Array spaces and not the value"
Like this: jdbc:mysql://localhost/home inventory  root    [C@5be5ab68 <--- Array space . What I doing wrong?
 try {
    Class.forName("org.gjt.mm.mysql.Driver"); //Load the driver
    String host = "jdbc:mysql://"+tServerHost.getText()+"/"+tSchema.getText();
        String uName = tUsername.getText();
        char[] l =  pPassword.getPassword();
        System.out.println(l);
        String password= l.toString();
        System.out.println(host+uName+l);
        con = DriverManager.getConnection(host, uName, password);
        System.out.println(host+uName+password);
    } catch (SQLException | ClassNotFoundException ex) {
    JOptionPane.showMessageDialog(this, ex.getMessage());
    } 
}