This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Using PreparedStatement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Using PreparedStatement" Watch "Using PreparedStatement" New topic

Using PreparedStatement

Tim Francisco

Joined: Apr 03, 2010
Posts: 12
Not sure what I am missing here but its driving me crazy. Its a simple PreparedStatement test program I am trying to test that I keeps failing. Here're the codes:

The exception is

I would appreciate if someone could help me figure out what's not right here.
Jan Cumps

Joined: Dec 20, 2006
Posts: 2491

What if you try: stmt.executeUpdate();

OCUP UML fundamental and ITIL foundation
youtube channel
kv ruby
Ranch Hand

Joined: Jul 23, 2009
Posts: 38
can you check the data type of value in DB?
if it is not integr then you will have to insert values in single quotes.

Regards, ruby kv
I agree. Here's the link:
subject: Using PreparedStatement
Similar Threads
Syntax error while inserting a file into Mysql database.
"main" java.sql.SQLException: Access denied for user 'root'@'' (using password: YES)
SQL formatting question
Error while using DriverManager to connect to MySQL DB.