jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes error in SQL statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "error in SQL statement" Watch "error in SQL statement" New topic

error in SQL statement

Eric Howell
Ranch Hand

Joined: Nov 26, 2000
Posts: 63

I have the following to insert 3 strings into a MySQL database.
The equivelent code works when I insert directly into the database but when I use JDBC I get the error :
" JDBC error: java.sql.SQLException: Syntax error or access violation: You have an error in your SQL syntax near ''urlString','FOX BROADCASTING COMPANY','...etc
I wonder if someone can spot what is wrong?
Thanks in advance

and later on
Marcos Maia
Ranch Hand

Joined: Jan 06, 2001
Posts: 977
I think you miss a space between the quotes and VALUES try it:
"INSERT INTO "+dbTable+" VALUES"...
Originally posted by Eric Howell:

and later on

Eric Howell
Ranch Hand

Joined: Nov 26, 2000
Posts: 63
Thanks Marcos for the prompt reply. That did the job great.
I agree. Here's the link: http://aspose.com/file-tools
subject: error in SQL statement
It's not a secret anymore!