File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes SQL Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "SQL Exception" Watch "SQL Exception" New topic

SQL Exception

shuzo monsoon
Ranch Hand

Joined: Feb 11, 2004
Posts: 54
Hello all. I can't figure out what is goin wrong with an INSERT SQL query I am using in a JSP page. Here is the code -

But when I attempt to execute this query, I get an SQLException error saying : Syntax error in INSERT INTO statement.
I have also tried using a prepared statement but I get the same error.
Can anyone help?
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

Numerical data should not be wrapped in ' '.
fox tie

Joined: Mar 29, 2004
Posts: 7
sometimes you must add database name before the table's name between a dot.
for example: book.order
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63837

sometimes you must add database name before the table's name between a dot.

Though this is clearly not one of those times.

[Asking smart questions] [About Bear] [Books by Bear]
Jon Egan
Ranch Hand

Joined: Mar 24, 2004
Posts: 83
Are there other inserts working for this table? possible that the table name itself is causing the problem, since ORDER is [part of] an ANSI SQL keyword (ORDER BY)?
I remember one time I was working with a field which held a description, and we were getting errors until we renamed it to "descr" instead of "desc" :roll:
Hope this is the problem, because it seems like it would be simple to fix...
-- Jon
Drew Dambrell

Joined: Mar 31, 2004
Posts: 6
you could use PL/SQL worksheet or someother interface app to test your query b4 you actually add it in your code
or something along those lines
[ March 31, 2004: Message edited by: Dru InHeaven() ]

Pimpin tha code, one servlet @ a time
I agree. Here's the link:
subject: SQL Exception
It's not a secret anymore!