Websphere Wierdness

I discovered a joyful thing with the websphere JDBC connection:

You want to make a prepared statement that uses the “like” operator.

You write :

select * from SOMETABLE where SOMECOLUMN like ?

and it throws an IndexOutOfBoundsException !!

YOU HAVE TO GET THE CASE CORRECT! so :

select * from SOMETABLE where SOMECOLUMN LIKE ?

or

select * from SOMETABLE where SOMECOLUMN Like ?

Weird eh ?

also if you want to select by a date you have to do :

select * from SOMETABLE where SOMEDATECOLUMN = to_date(?, ‘dd-mm-yyyy’)

putting in whatever format you have.

Share