Jarryd vn
Jarryd vn

Reputation: 31

UCAExc:::4.0.4 user lacks privilege or object not found: TBLUSERS

So I'm relatively new to databases in java and I recently encountered this problem while trying to add a username, password and email to my database from a Jframe login page.

Also the method that executes the SQL is in a separate class from the GUI and I just call the method from the btn action method in the GUI class.

Here's my Method

    public void RegisterUser(String u, String p, String m) {
    int num;
    try {
        String qry = "INSERT INTO tblUsers(Username,Password,E-Mail Address)"
                + " VALUES ('" + u + "','" + p + "','" + m + "')";
        PreparedStatement pstmt = conn.prepareStatement(qry);
        num = pstmt.executeUpdate();
        pstmt.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

Thanks :)

Upvotes: 0

Views: 532

Answers (1)

Jarryd vn
Jarryd vn

Reputation: 31

The problem was in the database connection, when running a query the connection fails if the database name has a space in between words

Upvotes: 0

Related Questions