System.out.println doesn't show the actual query that hits the database. I finally got
query logging working and was able to see that, for some reason, the parameter is
not being inserted in the PreparedStatement. When the query hits the db, the "?"
mark is still actually in the query! I have another successful query that looks exactly like the one
that fails; different columns are being queried, but the successful one has the value
set in the query whereas the unsuccessful one does not. I cannot see any difference in the
Jeanne Boyarsky wrote:I think Jamon does replace the values. In any case, you could post the query here with the "?" and see if anyone knows what is wrong. My guess would be a setXXX is incorrect.
Which actually leads to a way you can troubleshoot. Start with the working query and start replacing values with "?" until you get the error. That will tell you which parameter is causing a problem.
Joined: Sep 11, 2000
There is only one parameter in both queries; it is set with setString in both cases.
My database tables are corrupted; I'm trying to restore from the output of mysqldump, but I can't seem to get the syntax correct. I will be able to work with the prepared statement problem when I get the database restored.
mysqld-nt.exe is the executable for the service, not the command line utility used to enter sql statements. You should be using mysql.exe instead. There was no renaming of mysql to mysqld-nt in MySQL 5, the windows service has always been named mysqld-nt.exe, from what I recall. If you are missing mysql.exe, then I guess you probably unselected the option for the command line utilities during installation.
I'm as red faced as the staff at JavaRanch just said they are while working on their servers; anyway, I
have absolutely no idea what i was thinking because I do have mysql.exe. I need to get some sleep!
Stayed up way too late twice this week working on a project. Very sorry.
I still can't seem to get the syntax of the command correct, but hopefully soon I will.
Joined: Sep 11, 2000
Just to let you know that I was able to restore the database tables and both queries worked. It's magic and 3 days work!