When trying to do a search on a view I get the following error

java.sql.SQLException: Unknown Types value
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
        at 
com.mysql.jdbc.PreparedStatement.setObject(PreparedStatement.java:4314)
        at 
com.mysql.jdbc.PreparedStatement.setObject(PreparedStatement.java:4106)
        at 
org.apache.cayenne.access.types.CharType.setJdbcObject(CharType.java:169)
        at 
org.apache.cayenne.dba.JdbcAdapter.bindParameter(JdbcAdapter.java:542)
.
.
.

The PreparedStatement looks ok:

INFO: SELECT t0.id, t0.bookname, t0.count, t0.location_id, t0.book_id, 
t0.locationname FROM locationbook t0 WHERE UPPER(t0.bookname) LIKE UPPER(?) 
[bind: 1->bookname:'%naut%']

The bookname field is a varchar(100)

It works fine when I run a direct SQL statement on the db as:

SELECT t0.id, t0.bookname, t0.count, t0.location_id, t0.book_id, 
t0.locationname FROM locationbook t0 WHERE UPPER(t0.bookname) LIKE 
UPPER('%naut%')

I am using MySQL 5.5.22 and tried both mysql-connector-java-5.1.19 and 
mysql-connector-java-5.1.25 with the same result.


thanks in advance

mick
[Kimberley Training Institute Logo]
Toll Free: 1300 996 573 | Website: www.kti.wa.edu.au<http://www.kti.wa.edu.au>
Find us on Facebook<http://www.facebook.com/kimberleytraininginstitute>

Please consider the environment before printing this email.

Reply via email to