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

Software
Downloads
Documentation
CVS Repositories
Roadmap
License

About Enhydra.org
Who We Are
News, Articles & Events
Getting Involved
Contact Us

Community
Demos
Contributions
Resources
Case Studies
On The Edge! -NEW-
Commercial Vendors


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

Re: InstantDB: Illegal string size errors from indexed columns


Eric

I've been unable to repproduce this so far. Here's the script I used. 
I've tried to include most of the relevant details from the code that 
you sent, but I must have missde something out. Maybe you could modify 
the script.

d org.enhydra.instantdb.jdbc.idbDriver;
o jdbc:idb:c:/idb/bugs/sample.prp;

SET EXPORT "export0.txt" FIXEDLENGTH COLNAMEHEADER ROWNUMBERS 
CONTROLCOL SUMMARYHEADER TRACE 2 CONSOLE;

drop table airports;
create table airports (facility_id CHAR(11));
alter table airports add type CHAR(13);
alter table airports add airport_id CHAR(4);
alter table airports add region CHAR(3);
alter table airports add state_abbrev CHAR(2);
alter table airports add latitude double;
alter table airports add longitude double;
alter table airports add elevation int;
alter table airports add mag_var int;

insert into airports values (1, 2, 3, 4, 5, 6, 7, 8, 9);
q select * from airports;
create index i1 on airports (airport_id);

c close;
c exit;

Pete

----- Original Message -----
From: Eric Mackem <mackem@mitre.org>
Date: Wednesday, December 27, 2000 7:03 pm
Subject: 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 
> interestingthing 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 
> columnsin question can be displayed in the DBBrowser with no 
> errors.  The
> airport_id column in question is a three character string that 
> displayswith 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 
> entiredirectory 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 {
>     verifyConnection();
> 
>     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();     
> dropStatement.executeQuery(dropQuery);     dropStatement.close();
>     }
>     catch (SQLException se) {
>  se.printStackTrace();
>     }
> 
> 
>      String queryString = "CREATE INDEX " + indexName + " ON "
>      + tableName + " (" + indexColumn + ")";
> 
>     System.out.println("Executing SQL string: " + queryString);
> 
>     Statement statement = connection.createStatement();
>     statement.executeQuery(queryString);
>     statement.close();
> }
> catch (Exception e) {
>     System.out.println(e);
>     e.printStackTrace();
> }
>    }
> 
> This is the error that is generated:
> 
> Executing SQL string: CREATE INDEX airportsairport_idIndex ON airports
> (airport_id)
> 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(SQLProg.java:276)
> at
> org.enhydra.instantdb.jdbc.idbStatement.execute(idbStatement.java:235)
> at
> org.enhydra.instantdb.jdbc.idbStatement.executeQuery
(idbStatement.java:91)
> 
> at
> targets.manager.DatabaseManager.createIndex(DatabaseManager.java:148)
> at
> targets.manager.nfdc.NfdcAirportParser.parseAirports
(NfdcAirportParser.java:582)
> 
> at
> targets.manager.nfdc.NfdcParser.parseAllNfdcFiles(NfdcParser.java:315)
> at targets.manager.nfdc.NfdcParser$1.run(NfdcParser.java:169)
> 
> 
> 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 {
>     verifyConnection();
>     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]);
>     }
>     statement.close();
> }
> catch (Exception e) {
>     System.out.println(e);
> }
>    }
> 
> There are the string arrays the createTable method uses for the tables
> in question:
> 
> 
>    /**
>     * The Airport table names.
>     */
>    public static final String tableNames[] = {
> "airports",
> "airports_info"
>    };
> 
>    /**
>     * 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)"
> }
>    };
> 
> 
> Thanks,
> 
> Eric Mackem
> 
> 
> -------------------------------------------------------------------
> ----------
> To unsubscribe from this mailing list, send email to 
> majordomo@enhydra.orgwith 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 owner-instantdb@enhydra.org.
> 

-----------------------------------------------------------------------------
To unsubscribe from this mailing list, send email to majordomo@enhydra.org
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 owner-instantdb@enhydra.org.