Issue Details (XML | Word | Printable)

Key: DERBY-37
Type: Bug Bug
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: Major Major
Assignee: Unassigned
Reporter: Erik Bengtson
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

detection of incorrect types comparison is done at ? parameters

Created: 10/Oct/04 08:36 PM   Updated: 10/Feb/06 10:56 AM
Return to search
Component/s: SQL
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Environment: Cloudscape 10 beta

Resolution Date: 10/Feb/06 10:56 AM


 Description  « Hide
java code:

PreparedStatement ps = conn.prepareStatement(statement);

This statement:

SELECT THIS.CODE_EID,THIS.COMPOSED_EID,'org.jpox.samples.applicationidentity.ChildComposedIntID' as JPOXMETADATA ,THIS.INTEGER_IDX AS JPOXORDER0,ELEMENT_1.CODE,ELEMENT_1.COMPOSED,ELEMENT_1.DESCRIPTION,ELEMENT_1."NAME" FROM NORMALLISTAPPLICATIONID_COMPOS THIS INNER JOIN CHILDCOMPOSEDINTID "ELEMENT" ON THIS.CODE_EID = "ELEMENT".CODE AND THIS.COMPOSED_EID = "ELEMENT".COMPOSED INNER JOIN COMPOSEDINTID ELEMENT_1 ON "ELEMENT".CODE = ELEMENT_1.CODE AND "ELEMENT".COMPOSED = ELEMENT_1.COMPOSED WHERE THIS.NORMALLISTAPPLICATIONID_ID_OID = ? AND THIS.INTEGER_IDX >= ? ORDER BY JPOXORDER0

results in:

SQL Exception: Comparisons between 'VARCHAR' and 'INTEGER' are not supported.

possible cause:

The INTEGER_IDX is an INTEGER column. While running the prepareStatement, JDBC/Cloudscape thinks I'm comparing INTEGER_IDX with ? (question mark) (INTEGER vs VARCHAR). This is not true, ? (question mark) is a parameter that will be later substitued in my code by an integer value.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Jan Hlavatý added a comment - 10/Oct/04 08:49 PM
If this is the whole error message then error reporting in Derby needs an overhaul ;) I hate error messages of the type "Some error occured, but you have to guess what it is".

Are you sure its not something else? It's hard for us to tell without all the tables we don't have. Did you try removing the part with ? params? If you could strip the statement down to something reproducible on our side, it would help ;)

Erik Bengtson added a comment - 11/Oct/04 11:07 AM

"SQL Exception: Comparisons between 'VARCHAR' and 'INTEGER' are not supported."

The above text between quotes is the Derby exception. I suggest that you try this to reproduce:

create table xxxx ( COLUMN_A INT, COLUMN_B INT )

conn.prepareStatement("SELECT * FROM xxxx where COLUMN_B >= ?");

-------------------

The same code runs fine with MSSQL, MySQL, Postgresql, Oracle and others. If you need more information, ask me.

 

Mamta A. Satoor added a comment - 11/May/05 12:10 AM
I tried following on Derby and didn't get any comparison errors.
    s.executeUpdate("create table xxxx (COLUMN_A INT, COLUMN_B INT )");
    PreparedStatement ps = con.prepareStatement("select * from xxxx where COLUMN_B >= ?");
    ps.setInt(1,1);
    ps.execute();

Mike Matrigali made changes - 17/Aug/05 08:23 AM
Field Original Value New Value
Description java code:

PreparedStatement ps = conn.prepareStatement(statement);

This statement:

SELECT THIS.CODE_EID,THIS.COMPOSED_EID,'org.jpox.samples.applicationidentity.ChildComposedIntID' as JPOXMETADATA ,THIS.INTEGER_IDX AS JPOXORDER0,ELEMENT_1.CODE,ELEMENT_1.COMPOSED,ELEMENT_1.DESCRIPTION,ELEMENT_1."NAME" FROM NORMALLISTAPPLICATIONID_COMPOS THIS INNER JOIN CHILDCOMPOSEDINTID "ELEMENT" ON THIS.CODE_EID = "ELEMENT".CODE AND THIS.COMPOSED_EID = "ELEMENT".COMPOSED INNER JOIN COMPOSEDINTID ELEMENT_1 ON "ELEMENT".CODE = ELEMENT_1.CODE AND "ELEMENT".COMPOSED = ELEMENT_1.COMPOSED WHERE THIS.NORMALLISTAPPLICATIONID_ID_OID = ? AND THIS.INTEGER_IDX >= ? ORDER BY JPOXORDER0

results in:

SQL Exception: Comparisons between 'VARCHAR' and 'INTEGER' are not supported.

possible cause:

The INTEGER_IDX is an INTEGER column. While running the prepareStatement, JDBC/Cloudscape thinks I'm comparing INTEGER_IDX with ? (question mark) (INTEGER vs VARCHAR). This is not true, ? (question mark) is a parameter that will be later substitued in my code by an integer value.
java code:

PreparedStatement ps = conn.prepareStatement(statement);

This statement:

SELECT THIS.CODE_EID,THIS.COMPOSED_EID,'org.jpox.samples.applicationidentity.ChildComposedIntID' as JPOXMETADATA ,THIS.INTEGER_IDX AS JPOXORDER0,ELEMENT_1.CODE,ELEMENT_1.COMPOSED,ELEMENT_1.DESCRIPTION,ELEMENT_1."NAME" FROM NORMALLISTAPPLICATIONID_COMPOS THIS INNER JOIN CHILDCOMPOSEDINTID "ELEMENT" ON THIS.CODE_EID = "ELEMENT".CODE AND THIS.COMPOSED_EID = "ELEMENT".COMPOSED INNER JOIN COMPOSEDINTID ELEMENT_1 ON "ELEMENT".CODE = ELEMENT_1.CODE AND "ELEMENT".COMPOSED = ELEMENT_1.COMPOSED WHERE THIS.NORMALLISTAPPLICATIONID_ID_OID = ? AND THIS.INTEGER_IDX >= ? ORDER BY JPOXORDER0

results in:

SQL Exception: Comparisons between 'VARCHAR' and 'INTEGER' are not supported.

possible cause:

The INTEGER_IDX is an INTEGER column. While running the prepareStatement, JDBC/Cloudscape thinks I'm comparing INTEGER_IDX with ? (question mark) (INTEGER vs VARCHAR). This is not true, ? (question mark) is a parameter that will be later substitued in my code by an integer value.
Component/s SQL [ 11408 ]
Daniel John Debrunner added a comment - 24/Sep/05 12:58 PM
Should this be resolved as 'cannot reproduce'? Unless the sql definitions for the tables involved in the original query are supplied I don't see any way to move forward on this.

Erik Bengtson added a comment - 10/Feb/06 01:40 AM
please resolve it. if I get this again, I report it with complete test case

Satheesh Bandaram added a comment - 10/Feb/06 10:56 AM
Looks like Mamta tried to reproduce the problem and wasn't successful. Erik (orignial reporter) said OK to close this for now.

Satheesh Bandaram made changes - 10/Feb/06 10:56 AM
Resolution Cannot Reproduce [ 5 ]
Status Open [ 1 ] Resolved [ 5 ]
Satheesh Bandaram made changes - 10/Feb/06 10:56 AM
Status Resolved [ 5 ] Closed [ 6 ]