SQL Update exception?


When I tomcat run this preparedstatement an exception is thrown in the java tomcat window. Though I cannot find the exception in the log files.

Could I ask if I am correct in using statement.executeUpdate() ?

Or any there is any other small errors?


      PreparedStatement statement = null;

         conn = (Connection)source.getConnection();

         String sql = "UPDATE user SET firstname=? lastname=? email=? telno=? expertise=? WHERE email=?";

         statement = conn.prepareStatement(sql);
         int rowsChanged = statement.executeUpdate();

         if(rowsChanged > 0){
            return true;
      catch(SQLException e){
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

try this

String sql = "UPDATE user SET firstname=?, lastname=?, email=?, telno=?, expertise=? WHERE email=?";

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You need commas in your sql statement.
AntoniRyszard656Author Commented:
Thank you,

I would also be interested to ask, if you could explain the use of the ejb?

I wondered if the ejb was similar to hibernate, and helped in storing and retrieving objects from the database? And why text-books often dislike the ejb?


HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

>>I would also be interested to ask, if you could explain the use of the ejb?
Perhaps you would like to open a new question and close this one :)

AntoniRyszard656Author Commented:
I think I will keep the question open shortly incase others was the add.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.