Elias Martenson  wrote:

> I'm using SapDB with the Orion Application Server, and after 
> moving an 
> application from Postgres to SapDB I'm gettingg the following 
> error when 
> executing a finder EJB methd:
> 
>      com.evermind[Orion/1.6.0 (build 
> 10770)].server.rmi.OrionRemoteException: Transaction was rolled back: 
> Database error: com.sap.dbtech.jdbc.exceptions.DatabaseException: SAP 
> DBTech SQL: [-7016] (at 365) Parameter spec not allowed in 
> this context; 
> nested exception is:
>      com.sap.dbtech.jdbc.exceptions.DatabaseException: SAP 
> DBTech SQL: 
> [-7016] (at 365) Parameter spec not allowed in this context
> 
> The query is originally an EJB-QL query, but Orion tells me that the 
> generated SQL is the following:
> 
> select bug1.id, bug1.shortDescription, bug1.detailedDescription,
>         bug1.publicDescription, bug1.notesField, bug1.submittedDate,
>         bug1.closedDate, bug1.stateField, bug1.type, bug1.priority,
>         bug1.reportedVersion, bug1.fixedVersion, bug1.submitter,
>         bug1.ownerField, bug1.category, bug1.lastModified,
>         bug1.duplicateField, bug1.attachmentFileGroupId
> from Bug bug1
> where ((? is null) or bug1.category = ?)
>        and (bug1.priority >= ? and (bug1.priority <= ?
>               and (((? is null) or bug1.submitter = ?)
>               and (((? = false and ((? is null) or 
> bug1.ownerField = ?))
>               or (? = true and (bug1.ownerField is null)))
>               and ((? = true and bug1.stateField = 0)
>                 or ((? = true and bug1.stateField = 1)
>                 or ((? = true and bug1.stateField = 2)
>                 or (? = true and bug1.stateField = 3))))))))
> 
> The question marks are set up by the EJB container using a 
> PreparedStatement. These are the relevant data types (Java types in 
> parentheses):
> 
>      id: int (long)
>      priority: int (int)
>      stateField: int (int)
>      submitter: varchar (String)
>      ownerField: varchar (String)
>      category: varchar (String)
> 
> Does anyone have any ideas on where to start digging? I tried 
> the same 
> query, with some random values filled in in place of the 
> question marks 
> and I can't reproduce the problem.

It is really impossible to reproduce an error concerning parameter-usage
if one fills in some random values instead of the parameters. Therefore
I am not astonished about the last sentence.

Your problem are the '? is null' used in the query. SAP DB's kernel
need to describe which kind of parameter (an integer, a char (12) or 
varchar (47) or whatever else) will be expected as value of the parameter.
With <column> = ? it can be assumed that the parameter will have same
datatype and length as the column has, with ? = true it should be a boolean
value, but what about ? is null. It could be any datatype. And then 
SAP DB says ' oops, I do not know, please dear customer do not use a
parameter there'.

Sometimes it helps to say some_function (?) where some_function gives
the kernel an idea of the datatype, for example ABS (?) --> some number;
UPPER (?) --> some char, and so on.

Elke
SAP Labs Berlin

_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to