Subject RC3 Problem with Borland DataExpress Components
Author Rashid Motala
Hello,
 
I have finally made a test case of this problem, downloadable from:
 
 
(File is large because of DataExpress libraries and database)
 
This was last tested with Firebird 1.0 on WinXP Prof. and a version of Jaybird slightly later than RC3 (RC2 does not have this problem). JRE 1.4.1 was used.
 
The files must install in C:\ where the folder testcase will be created when the file is unzipped. This is because the database path is hardcoded. Edit TESTJAYBIRD.BAT to point to where your JRE is installed.
 
It seems to us now that this is related to the char/varchar bug that Ryan reported, because a QueryDataSet component internally uses PreparedStatements.
 
Oops, I forgot to include the source code in the download, so here it is (its short):
 
----------------------------------------------------------------------------------------------------------
package testjaybird;
 
import com.borland.dx.dataset.*;
import com.borland.dx.sql.dataset.*;
 
public class MainTest {
 
  //Construct the application
  public MainTest() {
 
    Database dbImpronetGen = new Database();
    QueryDataSet qdsSiteDetailsBySLA = new QueryDataSet();
    ParameterRow prSiteSLA = new ParameterRow();
    Column colSiteSLA = new Column();
 
    java.util.Properties pty = new java.util.Properties();
    pty.setProperty("charSet", "8859_1");  // Encoding
 
    dbImpronetGen.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor("jdbc:firebirdsql://localhost/C:/testcase/impronet.gdb", "SYSDBA", "masterkey", false, "org.firebirdsql.jdbc.FBDriver", pty));
 
    colSiteSLA.setCaption("Site SLA");
    colSiteSLA.setColumnName("SITE_SLA");
    colSiteSLA.setDataType(com.borland.dx.dataset.Variant.STRING);
    colSiteSLA.setPreferredOrdinal(0);
    colSiteSLA.setServerColumnName("");
    colSiteSLA.setSqlType(0);
 
    prSiteSLA.setColumns(new Column[] {colSiteSLA});
    prSiteSLA.setString("SITE_SLA", "01000000");
 
    String sql = "SELECT * FROM SITE WHERE SITE.SITE_SLA = :SITE_SLA";
    qdsSiteDetailsBySLA.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(dbImpronetGen, sql, prSiteSLA, true, Load.ALL));
 
    System.out.println("Trying to open connection and execute query");
 
    dbImpronetGen.openConnection();
    qdsSiteDetailsBySLA.executeQuery();
 
    System.out.println("Connection opened and query executed");
 
    String siteName = qdsSiteDetailsBySLA.getString("SITE_NAME");
    boolean enforceRouting = (qdsSiteDetailsBySLA.getShort("SITE_ENFORCEROUTING") == (short)1);
    String seed = qdsSiteDetailsBySLA.getString("SITE_SEED");
    int groupWord = qdsSiteDetailsBySLA.getInt("SITE_GROUPWORD");
    int siteID = qdsSiteDetailsBySLA.getInt("SITE_ID");
    boolean local = (qdsSiteDetailsBySLA.getShort("SITE_LOCAL") == (short)1);
 
    System.out.println("Site Name from query: " + siteName);
 
    qdsSiteDetailsBySLA.close();
    dbImpronetGen.closeConnection();
 
  }
 
  //Main method
  public static void main(String[] args) {
    new MainTest();
  }
 
}
 
----------------------------------------------------------------------------------------------------------
 
The above code comes up with "GDS Exception. Error reading data from the connection  Null" and sometimes with "Operation was cancelled".
 
Regards,
Rashid Motala