Menu

ClassCastException: when opening table with UcanAccess driver

Anonymous
2014-01-16
2014-01-18
  • Anonymous

    Anonymous - 2014-01-16

    Hi,

    trying http://sourceforge.net/projects/ucanaccess/ driver with SQLeo to open a MDB database (Without MS ACCESS installed)

    with
    java -classpath .;SQLeoVQB-2014.01.rc1.jar;D:\temp\UCanAccess-2.0.1-bin\lib\hsqldb.jar;D:\temp\UCanAccess-2.0.1-bin\lib\jackcess-2.0.1.jar;D:\temp\UCanAccess-2.0.1-bin\lib\commons-lang-2.6.jar;D:\temp\UCanAccess-2.0.1-bin\lib\commons-logging-1.0.4.jar;D:\temp\UCanAccess-2.0.1-bin\ucanaccess-2.0.1.jar com.sqleo.environment.Application

    and
    url = jdbc:ucanaccess://D:/temp/access/Comptoir.mdb;showschema=true

    with options "Quote identifiers" = Yes
    and "use schema in syntax" = No

    fails when trying to open Content window or launching query builder (from Designer)


    Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
    at net.ucanaccess.jdbc.UcanaccessDatabaseMetadata$MetadataResultSet.getString(UcanaccessDatabaseMetadata.java:49)
    at com.sqleo.environment.ctrl.define.TableMetaData.copy(TableMetaData.java:312)
    at com.sqleo.environment.ctrl.define.TableMetaData.getColumns(TableMetaData.java:148)

    Works fine from syntax window

    Any Idea ?
    Regards

     

    Last edit: PAscal 2014-01-19
  • Marco Amadei

    Marco Amadei - 2014-01-17

    Hi all, I'm the UCanAccess author.
    Simply you call getString on a Integer column and I do a casting instead of a conversion.
    I'll patch it in the 2.0.2 (but maybe it would be better if you called getObject or getInteger and so if you didn't let the driver do the conversion).
    Cheers Marco

     

    Last edit: Marco Amadei 2014-01-17
  • PAscal

    PAscal - 2014-01-17

    would it be possible to test an alpha version ?
    to confirm that the problem is there and not in a schema name or catalog not set
    because this should return a column name .... not an integer

    regards
    PAscal

     
  • Marco Amadei

    Marco Amadei - 2014-01-17

    Of course PAscal, it is possible.
    But I have successfully tested UCanAccess with many tools which are based on metadata (dbveaver, libre office, openffice, squirrel) so this problem is strange.
    Also, I have just tried this:

    ...
    DatabaseMetaData dbmd= this.ucanaccess.getMetaData();
    ResultSet rs=dbmd.getColumns(null, null, "NOROMAN", "ID");
    //where "noroman" =tableName,id="columnName"
    while(rs.next()){
    System.out.println("TABLE_NAME:"+rs.getString(3)+"="+rs.getString("TABLE_NAME"));
    System.out.println("COLUMN_NAME:"+rs.getString(4)+"="+rs.getString("COLUMN_NAME"));
    System.out.println("DATA_TYPE:"+rs.getInt(5)+"="+rs.getInt("DATA_TYPE"));
    }
    ...

    The output was:
    TABLE_NAME:NOROMAN=NOROMAN
    COLUMN_NAME:ID=ID
    DATA_TYPE:4=4

    So, it seems to be ok. Do you agree?

     

    Last edit: PAscal 2014-01-17
  • PAscal

    PAscal - 2014-01-18

    Thanks a lot !
    release UCanAccess 2.0.2 works fine with SQLeo: a perferct MS Access replacement :-)

    Regards
    PAscal

     

    Last edit: PAscal 2014-01-18

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.