I am using PreparedStatement to query my table. Unfortunately, I could not do this.
My code is as simple as this:
PreparedStatement preparedStatement = connection.prepareStatement(
"Select favoritefood from favoritefoods where catname = ?");
preparedStatement.setString(1, "Cappuccino");
ResultSet resultSet = preparedStatement.executeQuery();
Thrown error java.sql.SQLException: ORA-00911: invalid character
. As if it never goes through the given parameter.
Thank you for your time. I spent a day debugging this, but still unsuccessfully.
As Piyush mentions, if I omit the semicolon at the end of the statement, a new error occurs. java.sql.SQLException: ORA-00942: table or view does not exist
. But I can assure that this table really exists.
UPDATE
shoot. I edited the wrong sql. now it is successful. Thanks for your time.
source
share