Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

too few parameters error

843854Jun 22 2003 — edited Jun 22 2003
hi,
i keep getting the following error:
SQLException in PAUserBean - getWorkNumber java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
here is code:
public String getWorkNumber(String Id) {
	String workNumber = "";
	try {
		Connection conn = DriverManager.getConnection("jdbc:odbc:PA");
		Statement s = conn.createStatement();
		String sql = "SELECT WORKER.WORK_PHONE_NBR FROM WORKER WHERE WORKER.USER_ID=" + Id + ";";
		ResultSet rs = s.executeQuery(sql);
		if(rs.next()) {
			workNumber = formatPhoneNumber(rs.getString("WORK_PHONE_NBR"));	
		}
	}catch(SQLException e) {
		System.out.println("SQLException in PAUserBean - getWorkNumber " + e.toString());
	}
	return workNumber;
}
here is the database map:

WORKER TABLE:
USER_ID - Number (primary key)
WORK_PHONE_NMR - Text

I'm using an MS Access database, when i run the following query in MS Access it returns the number:
SELECT work_phone_nbr
FROM Worker
where id=102;
odd thing is the jsp page does display the number, meaning the query is ok, but i see tomcat's log with that error, any ideas what it means? what parameter am i missing?

Thank you.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 20 2003
Added on Jun 22 2003
1 comment
81 views