CARI Infonet

 Forgot password?
 Register

ADVERTISEMENT

View: 3326|Reply: 4

Invisible Syntax error?

[Copy link]
Post time 2-7-2007 08:21 PM | Show all posts |Read mode
String sql9 = "SELECT nme "+
"FROM table1 ";
Statement stmt9=conn.createStatement();
ResultSet rset9=stmt9.executeQuery("sql9");
while(rset9.next())
{
s = rset9.getString("nme");
}


org.apache.jasper.JasperException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sql9' at line 1
        org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Can anyone tell  me the probable cause of this to happen? I have check many times that there is no error with the syntax of the query statement.

[ Last edited by  Asiafever at 2-7-2007 08:23 PM ]
Reply

Use magic Report


ADVERTISEMENT


Post time 3-7-2007 08:56 PM | Show all posts

Reply #1 Asiafever's post

the only one i can see is the "sql9" in the statement

          ResultSet rset9=stmt9.executeQuery("sql9");

with double quote. that means u're executing a sql statement with body = sql9 not the actual statement you declared earlier.

Get rid of the double quote and hopefully it'd run ok.
Reply

Use magic Report

 Author| Post time 4-7-2007 06:29 PM | Show all posts

Reply #2 alusmetai's post

Oh my god!!! How can I miss that thing even though I look at it thousand of times???

Thanks..................... Sigh...I really need to check my eyes...
Reply

Use magic Report

Post time 4-7-2007 11:09 PM | Show all posts

Reply #3 Asiafever's post

haha....even experienced programmer did make silly mistakes sometimes....
Reply

Use magic Report

Post time 5-7-2007 02:05 AM | Show all posts
haha it happens. I once wrote

    if (...........);
    {
        ........;
    }
    .....
and got bizarre behavior and wondered on and on what's going on. hahahaha!

[ Last edited by  alusmetai at 5-7-2007 02:11 AM ]
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT


Forum Hot Topic

 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CARI Infonet

25-4-2024 06:36 AM GMT+8 , Processed in 0.203751 second(s), 28 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list