aspose file tools
The moose likes JDBC and the fly likes properties file with SQL statements Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "properties file with SQL statements" Watch "properties file with SQL statements" New topic
Author

properties file with SQL statements

Alan Shiers
Ranch Hand

Joined: Sep 24, 2003
Posts: 216
Hi there,

I'm running an application that is connected to a MySQL database. I have a Servlet with a method that connects to the database and attempts to update a table named INSTRUCTORS. I keep a properties file full of SQL statements, one of which is:

updateInstructorQuery=UPDATE INSTRUCTORS SET ADMINISTRATOR_ID=?, RETIRED_ADMIN_ID=NULL, EMPLOYEE_ID=?, FIRSTNAME=?, LASTNAME=?, DEPARTMENT=?, WORK_PHONE=?, ADDRESS=?, CITY=?, STATE_PROVINCE=?, COUNTRY=?, ZIP_PCODE=?, HOME_PH0NE=?, CELL=? WHERE COMPANY_ID=? AND EMPLOYEE_ID=?;

When I run the method I keep getting an SQLException:

SQL Problem: Column not found message from server: "Unknown column 'HOME_PH0NE' in 'field list'"
SQL State: S0022
Vendor Error: 1054
20 [http-8080-Processor24] ERROR mvcs.InstructorModel - SQL Exception
java.sql.SQLException: Column not found message from server: "Unknown column 'HOME_PH0NE' in 'field list'"

I don't understand why I'm getting this exception when the HOME_PHONE field is definitely a field in the table INSTRUCTORS! I'm thinking there must be something wrong with my SQL statement, but I don't see it!

Please Advise,

Alan
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16482
    
    2

Fortunately you used copy-and-paste to post this question, because I can see that you have a digit-zero instead of a letter-O in the middle of PH0NE.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56162
    
  13

Moved to the JDBC forum.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Alan Shiers
Ranch Hand

Joined: Sep 24, 2003
Posts: 216
Well, I'll be...

That's it! I knew it had to be something really stupid. But yesterday I just couldn't see it. That was supposed to be an O not a zero 0.

Thanks Again,

Alan
 
I agree. Here's the link: http://jrebel.com/download
 
subject: properties file with SQL statements
 
Similar Threads
Im a bit confused
Hibernate getting started
Java and Crystal Reports XI: Dynamic Changing of Data Source
Hibernate: Default Binding of database field
Cursor object not returning data properly.