|Eclipselink queries on DB2 [message #390611]
||Wed, 29 July 2009 11:38
Registered: July 2009
Hello! Our application has successfully worked on both Oracle and |
SQLServer database. Now I need to use DB2 database, also. I have set
target database properties to DB2, created schema and it seemed to work.
But then it turned out that I keep getting error -418 for some queries:
STRING TO BE PREPARED CONTAINS INVALID USE OF PARAMETER MARKERS
Of course, I have looked into it. Google is our friend, but I couldn't
find any reference regarding using toplink/eclipselink. On the other hand,
it turns out that the error is quite common when using pure JDBC and
parameter queries such as mine. References I found say that sometimes DB2
does not know the type of given parameter, so explicit type cast needs to
be done. For instance,
select * from mytable t where t.name like ?
should use explicit cast
select * from mytable t where t.name like (cast ? as varchar(300))
or something like that.
But, I use JPA query language and I don't have control over how my query
is actually translated.
So, does anyone have any experience with DB2 database and these kinds of
queries and could workaround be found?