0

I have a problem with this query :

insert into PLAYER(PSEUDO, EMAIL, PASSWORD) values("Test","[email protected]",md5('pass'));

It works on phpMyAdmin, but in Eclipse it goes in the catch...

Can you tell me why ?

EDIT:

            // Si un textfield n'est pas renseignŽ (length=0), on affiche un
            // MessageDialgo...Sinon, on proc�de ˆ l'inscription (insert...)
            if (tfRegisterPseudo.getText().length() == 0
                    || tfRegisterEmail.getText().length() == 0
                    || tfRegisterPassword.getPassword().length == 0)
                JOptionPane.showMessageDialog(null,
                        "You forgot something...");
            else {
                query = "insert into PLAYER(PSEUDO, EMAIL, PASSWORD) "
                        + "values(\"" + tfRegisterPseudo.getText()
                        + "\",\"" + tfRegisterEmail.getText() 
                        + "\",md5('" + String.valueOf(tfRegisterPassword.getPassword()) + "'));";
                transmission.executeUpdate(query);
                JOptionPane.showMessageDialog(null,"Successfully registered !");
            }

            setContentPane(buildLogin());
            this.setVisible(true);

        } catch (Exception m) {
            // TODO Recuperer l'erreur de la BD et l'afficher
            System.out.println("An error occured.");
            JOptionPane.showMessageDialog(null,"An error occured.");
            System.out.println(query);
        }
    }
2
  • 2
    Can you share your java code? Commented Feb 13, 2014 at 14:16
  • and the stack trace since it goes into the catch. Commented Feb 13, 2014 at 14:18

1 Answer 1

2

In your code you use md5, which is a php-function. In java using the md5 hash algorithm will have to be called in a different manner.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.