AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

"Results returned for UPDATE ONLY"

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases
View previous topic :: View next topic  
Author Message
Al
Guest





PostPosted: Wed Dec 15, 2004 8:09 pm    Post subject: "Results returned for UPDATE ONLY" Reply with quote



I just put together some servlets to communicate with MYSQL. One merely
accepts a string as input in a form and sends it to MYSQL. I have a table
named 'articles', with columns 'name' and 'summary'. I can INSERT values
in to the table, by sending:
insert into articles (name,summary) values ('a', 'b')

That works fine. But when I try:
select * from articles
I get the error:
java.sql.SQLException: Results returned for UPDATE ONLY.

What am i doing wrong? Thanks.
Back to top
Mark Matthews
Guest





PostPosted: Wed Dec 15, 2004 10:32 pm    Post subject: Re: "Results returned for UPDATE ONLY" Reply with quote



Al wrote:
Quote:
I just put together some servlets to communicate with MYSQL. One merely
accepts a string as input in a form and sends it to MYSQL. I have a table
named 'articles', with columns 'name' and 'summary'. I can INSERT values
in to the table, by sending:
insert into articles (name,summary) values ('a', 'b')

That works fine. But when I try:
select * from articles
I get the error:
java.sql.SQLException: Results returned for UPDATE ONLY.

What am i doing wrong? Thanks.

Al,

My guess is you're calling Statement.executeUpdate("SELECT ..."), which
is not allowed by the JDBC spec...You should use
Statement.executeQuery(""), if you _know_ result set(s) will be
returned, and Statement.execute(""), if you don't know ahead-of-time
whether the operation is DML or a query.

Regards,

-Mark

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.