aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "error in SQL statement" Watch "error in SQL statement" New topic
Author

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
hi,
I think you miss a space between the quotes and VALUES try it:
"INSERT INTO "+dbTable+" VALUES"...
Originally posted by Eric Howell:
[B]

and later on
[/B]

Eric Howell
Ranch Hand

Joined: Nov 26, 2000
Posts: 63
Thanks Marcos for the prompt reply. That did the job great.
Cheers
Eric
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: error in SQL statement