We have a db2 database v 9.7 FP 1

We have a table something like this:

```
CREATE TABLE TAB1(COL1 VARCHAR(30),...);

```

Our application takes col1 value from front end and forms a PreparedStatement in Java 7, something like this: `SELECT FROM TAB1 WHERE COL1 = '?'`. If the input from UI is having > 30 characters, on execution of the prepared statement, we are getting an error with DB2

```
 Error Code: -302

```

But the same statement i.e., SELECT \* FROM TAB1 WHERE COL1 = 'XXXXX'; (with COL1 length > 30 characters), if executed directly on the database from cmd, we are not encountering any errors. 

What are the possible reasons for this error message?