Issue Details (XML | Word | Printable)

Key: JDBC-94
Type: Bug Bug
Status: Resolved Resolved
Resolution: Won't Fix
Priority: Major Major
Assignee: Roman Rokytskyy
Reporter: Dainius Daujotas
Votes: 0
Watchers: 0
Operations

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

Exception in thread "main" org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic SQL Error

Created: 09/Jan/07 02:46 PM   Updated: 06/May/12 06:27 AM
Component/s: JDBC driver
Affects Version/s: Jaybird 2.1
Fix Version/s: None

Issue Links:
Relate


 Description  « Hide
I tested with latest 2.1.1 driver;
SQL command is corrent wnd well runs directly in isql. But from jdbc prepared statement throws exception:
Exception in thread "main" org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -804
Data type unknown
        at org.firebirdsql.jdbc.AbstractPreparedStatement.<init>(AbstractPreparedStatement.java:119)
        at org.firebirdsql.jdbc.FBPreparedStatement.<init>(FBPreparedStatement.java:41)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at org.firebirdsql.jdbc.FBStatementFactory.createPreparedStatement(FBStatementFactory.java:90)
        at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:869)
        at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:824)
        at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:817)
        at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:293)
        at test2.Main.main(Main.java:48)
at org.firebirdsql.gds.GDSException: Dynamic SQL Error
SQL error code = -804
Data type unknown
        at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.readStatusVector(AbstractJavaGDSImpl.java:2124)
        at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.receiveResponse(AbstractJavaGDSImpl.java:2074)
        at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.iscDsqlPrepare(AbstractJavaGDSImpl.java:1498)
        at org.firebirdsql.gds.impl.GDSHelper.prepareStatement(GDSHelper.java:196)
        at org.firebirdsql.jdbc.AbstractStatement.prepareFixedStatement(AbstractStatement.java:1129)
        at org.firebirdsql.jdbc.AbstractPreparedStatement.prepareFixedStatement(AbstractPreparedStatement.java:1157)
        at org.firebirdsql.jdbc.AbstractPreparedStatement.<init>(AbstractPreparedStatement.java:116)
        at org.firebirdsql.jdbc.FBPreparedStatement.<init>(FBPreparedStatement.java:41)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at org.firebirdsql.jdbc.FBStatementFactory.createPreparedStatement(FBStatementFactory.java:90)
        at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:869)
        at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:824)
        at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:817)
        at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:293)
        at test2.Main.main(Main.java:48)
Java Result: 1

SQL generated by hibernate:
select newstopice0_.id as id13_, newstopice0_.topicName as topicName13_, newstopice0_.deploymentDate as deployme3_13_, newstopice0_.undeploymentDate as undeploy4_13_, newstopice0_.status as status13_ from n$topics newstopice0_ where (? in (select interests1_.interests_id from n$topics_n$interests interests1_ where newstopice0_.id=interests1_.n$topics_id)) and newstopice0_.status=?

Tables DDL:

CREATE TABLE N$INTERESTS(
  ID Numeric(18,0) NOT NULL,
  GROUPNAME Varchar(255),
  PRIMARY KEY (ID)
);
GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE
 ON N$INTERESTS TO SYSDBA WITH GRANT OPTION;

CREATE TABLE N$TOPICS(
  ID Numeric(18,0) NOT NULL,
  TOPICNAME Varchar(255),
  DEPLOYMENTDATE Date,
  UNDEPLOYMENTDATE Date,
  STATUS Smallint,
  PRIMARY KEY (ID)
);
GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE
 ON N$TOPICS TO SYSDBA WITH GRANT OPTION;

CREATE TABLE N$TOPICS_N$INTERESTS(
  N$TOPICS_ID Numeric(18,0) NOT NULL,
  INTERESTS_ID Numeric(18,0) NOT NULL
);
ALTER TABLE N$TOPICS_N$INTERESTS ADD CONSTRAINT FKD52C732E5DCE65D6
  FOREIGN KEY (INTERESTS_ID) REFERENCES N$INTERESTS (ID);
ALTER TABLE N$TOPICS_N$INTERESTS ADD CONSTRAINT FKD52C732EC0D028C
  FOREIGN KEY (N$TOPICS_ID) REFERENCES N$TOPICS (ID);
GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE
 ON N$TOPICS_N$INTERESTS TO SYSDBA WITH GRANT OPTION;




 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Mark Rotteveel added a comment - 06/May/12 06:26 AM
This is a limitation of Firebird itself: the type of the parameter in '? IN (subselect)' cannot be determined. It will be fixed in Firebird 3.0 (see CORE-2697, see CORE-3842 for an example which also demonstrates the problem from ISQL). The change will potentially be backported to a future sub-release of Firebird 2.5 as well.

The workaround is to rewrite the query to use EXISTS (SELECT 1 FROM ... WHERE field=?).

Mark Rotteveel added a comment - 06/May/12 06:27 AM
Marked as won't fix, as this can't be fixed in Jaybird itself.