InstantDB Project
About InstantDB
Project Mail Lists
Short History
Reporting Bugs
Screen Shots
3rd Party Examples

CVS Repositories

Who We Are
News, Articles & Events
Getting Involved
Contact Us

Case Studies
On The Edge! -NEW-
Commercial Vendors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

InstantDB: Illegal string size errors from indexed columns

Hi all,

I have code which creates indexes on idb tables.  The create index
command gives a java exception for Illegal string size.  The interesting
thing about this error is that it occurs only with the InstantDB version
3.25 that I am attempting to upgrade to.  The code works fine under Idb
3.12.  I also get no errors if I do not use indexes or primary keys.
(Not that I consider that an acceptible work around!)  Also, the columns
in question can be displayed in the DBBrowser with no errors.  The
airport_id column in question is a three character string that displays
with no problems in the browser.   This error occurs with all columns
I try to index or use as primary keys (again only in Idb 3.25, not
3.12), and again, I can store and retrieve this data with no problems as
long as I do not create indexes or pks)  I have also removed the entire
directory that stores the database information to test whether indexes
or tables created under the old idb 3.12 where causing the problem.
The error still occurred.

Are there any changes in the string handling, particulary as related to
indexes, that I need to take into account?

Here is some of the relevant code

This is the method with creates the index:
     * Creates an index with the name columnNameIndex
     * @param names The names of the table to create an index on
     * @param columnNames The names of the columns that will be indexed
    public void createIndex(String tableName,
          String indexColumn) {
 try {

     String indexName = tableName + "_" + indexColumn + "_" + "Index";

     try {

     String dropQuery = "DROP INDEX " + indexName + " ON " + tableName;
     System.out.println("About to execute SQL: " + dropQuery);
     Statement dropStatement = connection.createStatement();
     catch (SQLException se) {

      String queryString = "CREATE INDEX " + indexName + " ON "
      + tableName + " (" + indexColumn + ")";

     System.out.println("Executing SQL string: " + queryString);

     Statement statement = connection.createStatement();
 catch (Exception e) {

This is the error that is generated:

Executing SQL string: CREATE INDEX airportsairport_idIndex ON airports
java.sql.SQLException: Problem reading column, airport_id, in table,
airports, java.lang.Exception: Illegal string size: 3145783
java.sql.SQLException: Problem reading column, airport_id, in table,
airports, java.lang.Exception: Illegal string size: 3145783
 at org.enhydra.instantdb.db.SQLProg.execute(


 at targets.manager.nfdc.NfdcParser$

I tried to decompile the java to get a better idea what about the
error.  The idbStatement.class file decompiled fine, but was just a call
to the SQLProg.class file.  Unfortunately this files caused an error in
the mocha decompiler, so I could not look at the code there.

Here is the code that created the tables in question:

     * Create the tables with the given names and columns.
     * @param names The names of the tables to create.
     * @param columnNames The names of the columns and their data types.

    protected static void createTables(String names[],
           String columnNames[][]) {
 try {
     Statement statement = connection.createStatement();
     for (int i=0; i < names.length; i++) {
  // statement.executeQuery("CREATE TABLE " + names[i] + " (" +
  //    columnNames[i][0] + " PRIMARY KEY)");
   statement.executeQuery("CREATE TABLE " + names[i] + " (" +
           columnNames[i][0] + " )");
  for (int j=1; j < columnNames[i].length; j++)
      statement.executeQuery("ALTER TABLE " + names[i] +
        " ADD " + columnNames[i][j]);
 catch (Exception e) {

There are the string arrays the createTable method uses for the tables
in question:

     * The Airport table names.
    public static final String tableNames[] = {

     * The column names.
    public static final String columnNames[][] = {
     "facility_id CHAR(11)",
     "type CHAR(13)",
     "airport_id CHAR(4)",
     "region CHAR(3)",
     "state_abbrev CHAR(2)",
     "latitude double",
     "longitude double",
     "elevation int",
     "mag_var int"
     "facility_id CHAR(11)",
     "cycle_date CHAR(10)",
     "district CHAR(4)",
     "state CHAR(20)",
     "county CHAR(21)",
     "county_state CHAR(2)",
     "city CHAR(26)",
     "name CHAR(42)",
     "owner_type CHAR(2)",
     "use CHAR(2)",
     "owner CHAR(29)",
     "owner_address CHAR(29)",
     "owner_city_state_zip CHAR(29)",
     "owner_phone CHAR(12)",
     "manager CHAR(29)",
     "manager_address CHAR(29)",
     "manager_city_state_zip CHAR(29)",
     "manager_phone CHAR(12)",
     "arp_method CHAR(1)",
     "elevation_method CHAR(1)",
     "mag_var_epoch CHAR(4)",
     "traffic_pattern_alt int",
     "chart CHAR(16)",
     "business_district_distance int",
     "business_district_direction CHAR(3)",
     "artcc_id CHAR(3)",
     "artcc_computer_id CHAR(3)",
     "artcc_name CHAR(20)",
     "responsible_artcc_id CHAR(3)",
     "responsible_artcc_computer_id CHAR(3)",
     "responsible_artcc_name CHAR(20)",
     "fss_on_facility CHAR(1)",
     "fss_id CHAR(4)",
     "fss_name CHAR(26)",
     "apt_to_fss_phone CHAR(16)",
     "alt_fss_id CHAR(4)",
     "alt_fss_name CHAR(26)",
     "apt_to_alt_fss_phone CHAR(16)",
     "notam_facility CHAR(4)",
     "notam_d_available CHAR(1)",
     "activation_date CHAR(7)",
     "certification_type_date CHAR(10)",
     "nasp_fed_agreements CHAR(7)",
     "airspace_analysis CHAR(13)",
     "international CHAR(1)",
     "customs_landing_rights CHAR(1)",
     "joint_use CHAR(1)",
     "military CHAR(1)",
     "nat_emer_status CHAR(18)",
     "military_depts CHAR(6)",
     "inspection_method CHAR(2)",
     "inspection_agency CHAR(1)",
     "last_inspection_date CHAR(8)",
     "last_info_request_date CHAR(8)",
     "fuel_types CHAR(40)",
     "airframe_repair CHAR(5)",
     "engine_repair CHAR(5)",
     "bottled_oxygen CHAR(8)",
     "bulk_oxygen CHAR(8)",
     "attendance_sched CHAR(77)",
     "lighting_sched CHAR(9)",
     "atc_tower_at_apt CHAR(1)",
     "unicom_frequencies CHAR(42)",
     "ctaf CHAR(7)",
     "seg_circle_marker CHAR(1)",
     "lens_color CHAR(3)",
     "non_commercial_landing_fee CHAR(1)",
     "sing_engine_ga CHAR(3)",
     "mult_engine_ga CHAR(3)",
     "jet_ga CHAR(3)",
     "ga_heli CHAR(3)",
     "oper_glider CHAR(3)",
     "oper_military CHAR(3)",
     "ultralight CHAR(3)",
     "commercial_services CHAR(6)",
     "air_taxi CHAR(6)",
     "ga_local CHAR(6)",
     "ga_itinerant CHAR(6)",
     "military_operations CHAR(6)"


Eric Mackem

To unsubscribe from this mailing list, send email to
with the text "unsubscribe instantdb" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at