User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 422,414 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 5,060 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 13195 | Replies: 13
Reply
Join Date: Nov 2004
Location: Netherlands
Posts: 5,752
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 197
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Please help with JSP mysql update query

  #11  
May 25th, 2008
in fact its only commonality with Javascript is that it's a mess (which it happens to have in common with php as well).
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 6,851
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 344
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: Please help with JSP mysql update query

  #12  
May 26th, 2008
> Javascript is amazing, I didn't think you could touch mysql with it!

You can't, at least not with browser embedded Javascript. It's a different ball game altogether if you are using Server Side Javascript.
I don't accept change. I don't deserve to live.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Join Date: Mar 2007
Posts: 10
Reputation: articles is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
articles articles is offline Offline
Newbie Poster

Re: Please help with JSP mysql update query

  #13  
May 28th, 2008
The code you have written is correct... but java is a case sensitive language so might be there is some problem with the case..

check it carefully
Reply With Quote  
Join Date: Feb 2006
Posts: 1,450
Reputation: masijade is just really nice masijade is just really nice masijade is just really nice masijade is just really nice masijade is just really nice 
Rep Power: 9
Solved Threads: 129
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Virtuoso

Re: Please help with JSP mysql update query

  #14  
May 28th, 2008
Originally Posted by articles View Post
The code you have written is correct... but java is a case sensitive language so might be there is some problem with the case..

check it carefully


To tell you the truth, the code is not correct. This line
int UQ=statement.executeUpdate("insert into questions (qid, question, answer, subject) values ('," + questionin + "," + answerin + "," + subjectin + ")"); 
is definately false (and the cause of the sql error, as noted earlier). Where is the closing quote (') after the variable questionin? And why are there no quotes around any of the others?

All this would not be a problem if the OP would two things that she should always do, and should have done from the beginning (but she probably learned from tutorials on roseindia, they love pushing this dope), which are:

1) Use a PreparedStatement. Do not cobble together a Statement like this. It is error prone in the coding, error prone in the execution (what happens if one of the variables contains a quote (') itself), and wide open to SQL injection attacks.

2) Don't use scriplets. They only still exist for backwards compatability and it is strongly reccommended not to use them anymore.
Last edited by masijade : May 28th, 2008 at 8:31 am.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JSP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 9:32 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC