GeeCON Prague 2014*
The moose likes JDBC and the fly likes SQL syntax error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL syntax error" Watch "SQL syntax error" New topic
Author

SQL syntax error

Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
I am getting a SQL syntax error when I try to execute an INSERT...INTO command via JDBC. Unfortunately, the message is not very helpful! Maybe I'm just spoiled by the nice messages that Sun's Java compiler gives for my Java code. Anyway, here is the code that causes the error:



And here is the stack trace for the exception:



The SQLUtil class is a nice little utility that takes care of a lot of the complexities of JDBC for me. Also it makes commonly used code very reusable. I won't post it here unless I need. Most of the methods I use here are delegated directly to a PreparedStatement.

Any ideas what the problem is with my SQL statement?

I will greatly appreciate any help.

Layne


Java API Documentation
The Java Tutorial
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61298
    
  66

And like Java code, be sure to balance your parentheses.
[ June 08, 2005: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Originally posted by Bear Bibeault:
And like Java code, be sure to balance your parentheses.

[ June 08, 2005: Message edited by: Bear Bibeault ]




Is that all it is! *mutters* Why can't the error message say so! I nice little "expected ')'" shouldn't be too difficult!

Thanks, Bear!!! Once I add a paren, I hope it works.

Layne
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL syntax error