Issue Details (XML | Word | Printable)

Key: JDBC-335
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Mark Rotteveel
Reporter: David Smith
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
Jaybird JCA/JDBC Driver

Calls to getCrossReference fail

Created: 01/Jan/14 07:57 PM   Updated: 27/Apr/14 01:41 PM
Component/s: JDBC driver
Affects Version/s: Jaybird 2.2.4
Fix Version/s: Jaybird 2.2.5, Jaybird 3.0.0

Environment: Win 8.1, JDK 1.6
Issue Links:

 Description  « Hide
Calls to

databaseMetaData.getCrossReference(null, null, parentTable, null, null, foreignTable)

fails w/

org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, column 520
at org.firebirdsql.jdbc.AbstractPreparedStatement.<init>(
at org.firebirdsql.jdbc.FBPreparedStatement.<init>(
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
at java.lang.reflect.Constructor.newInstance(
at org.firebirdsql.jdbc.FBStatementFactory.createPreparedStatement(
at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(
at org.firebirdsql.jdbc.AbstractConnection.prepareMetaDataStatement(
at org.firebirdsql.jdbc.AbstractDatabaseMetaData.getStatement(
at org.firebirdsql.jdbc.AbstractDatabaseMetaData.doQuery(
at org.firebirdsql.jdbc.AbstractDatabaseMetaData.getCrossReference(

The problem:
A space is missing before the "from" clause of the query that pulls the data.

class : org.firebirdsql.jdbc.AbstractDatabaseMetaData

   private static final String GET_CROSS_KEYS = "select "
    /*+" null as PKTABLE_CAT "
    +" ,null as PKTABLE_SCHEM "*/
    +"cast(PK.RDB$RELATION_NAME as varchar(31)) as PKTABLE_NAME"
    +",cast(ISP.RDB$FIELD_NAME as varchar(31)) as PKCOLUMN_NAME"
    /*+" ,null as FKTABLE_CAT "
    +" ,null as FKTABLE_SCHEM "*/
    +",cast(FK.RDB$RELATION_NAME as varchar(31)) as FKTABLE_NAME"
    +",cast(ISF.RDB$FIELD_NAME as varchar(31)) as FKCOLUMN_NAME"
    +",cast(RC.RDB$UPDATE_RULE as varchar(11)) as UPDATE_RULE"
    +",cast(RC.RDB$DELETE_RULE as varchar(11)) as DELETE_RULE"
    +",cast(PK.RDB$CONSTRAINT_NAME as varchar(31)) as PK_NAME"
    +",cast(FK.RDB$CONSTRAINT_NAME as varchar(31)) as FK_NAME"
    /*+" ,null as DEFERRABILITY "*/
    +"from " <**************************************************************** NEEDS A SPACE BEFORE THE FROM

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Mark Rotteveel added a comment - 02/Jan/14 05:03 PM
Caused by the changes of JDBC-331, I assumed that all methods changed in that issue were already covered by tests, turns out getCrossReference wasn't.

Basic fix committed, still remaining is adding additional tests and double checking the other methods changed by JDBC-331.

I will release 2.2.5 shortly to address this.

Mark Rotteveel added a comment - 05/Jan/14 01:05 PM
Add additional tests to Jaybird 2.2 and trunk