Java.sql.SQLException: [Microsoft] [ODBC Microsoft Access Driver] Too few parameters

There seems to be an exception in this part of my code:

c = dbConnection.getConnection(); q = "SELECT * FROM book WHERE nextInc<=? AND inlib=?"; s = c.prepareStatement(q); s.setBigDecimal(1,BigDecimal.valueOf(curDate.getTime())); s.setBoolean(2,false); rs = s.executeQuery(); <-- Error. 

I am using "sun.jdbc.odbc.JdbcOdbcDriver".

+4
source share
2 answers

According to this , an error may occur due to a nonexistent column.

Could you place the table structure here?

+5
source

After checking all the column names, I also found that double quotes around the string literal would cause the same error.

False: WHERE foo LIKE "bar"

Right: WHERE foo LIKE 'bar'

Just FYI for any people without access, scratching their heads (like me).

0
source

Source: https://habr.com/ru/post/1302567/


All Articles