Options

DatabaseExampleSource - Fail to convert to internal representation

nicugeorgiannicugeorgian Member Posts: 31 Maven
edited November 2018 in Help
Hello,

when using the DatabaseExampleSource with an Oracle database system, I get the following warning several times:

'Cannot read database data: Fail to convert to internal representation [class java.sql.SQLException]

Do you happen to know what this exactly means?

Many thanks!

Geo
Tagged:

Answers

  • Options
    nicugeorgiannicugeorgian Member Posts: 31 Maven
    I have actually noticed that there are attempts to convert every table column's value to each of the following types: String, Int, Double.

    If a column's value is string, then the above warning is issued when attempting to convert the value to the types Int and Double.

    It's still not clear to me why these attempts to convert to the types String, Int, and Double ... Any ideas?

    Geo
  • Options
    IngoRMIngoRM Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,751 RM Founder
    Hi Geo,

    could it be that you have defined the value types for the attributes as numerical but the data columns actually contain strings?

    Cheers,
    Ingo
  • Options
    nicugeorgiannicugeorgian Member Posts: 31 Maven
    Hi Ingo,

    thanks for the answer. I don't exacly understand what you say.

    I got this warnings at the console, when I run the Java program that contains a DatabaseExampleSource operator.

    I think it has to do with the "datamanagement" parameter of the DatabaseExampleSource operator. This parameter determines how the data is represented internally. I think the default value of this parameter is "double_array".

    I have both numerical attributes and nominal (categorical) attributes. It's not clear to me how to specify with the DatabaseExampleSource operator (and with the Weka learner I subsequently use) the attributes' types.  :(

    Any idea?

    Many thanks!

    Cheers,
    Geo
  • Options
    IngoRMIngoRM Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,751 RM Founder
    Hello Geo,

    ok, I digged a bit deeper. To start with, it has nothing to do with the "datamanagement" parameter. This just defines how data is internally represented  by RapidMiner when loaded into memory. But this does not cause the problem here since the error is an Oracle specific error with error code 17059. I searched for the phrase "Fail to convert to internal representation [class java.sql.SQLException]" in Google and found for example this link:

    http://www.dbmotive.com/oracle_error_codes.php?errcode=17059

    It seems that your Oracle database contains at least one column with a Oracle data type not known to your JDBC driver /  the types defined by Java. We currently support the types

    case Types.BIGINT:
    case Types.INTEGER:
    case Types.TINYINT:
    case Types.SMALLINT:
    return Ontology.INTEGER;

    case Types.FLOAT:
    case Types.REAL:
    case Types.DECIMAL:
    case Types.DOUBLE:
    return Ontology.REAL;

    case Types.NUMERIC:
    return Ontology.NUMERICAL;

    case Types.CHAR:
    case Types.VARCHAR:
    case Types.CLOB:
    case Types.BINARY:
    case Types.BIT:
    case Types.LONGVARBINARY:
    case Types.BLOB:
    case Types.JAVA_OBJECT:
    case Types.STRUCT:
    case Types.VARBINARY:
    case Types.LONGVARCHAR:
    return Ontology.NOMINAL;

    case Types.DATE:
    case Types.TIME:
    case Types.TIMESTAMP:
    return Ontology.ORDERED;

    default:
    return Ontology.NOMINAL;
    The return value shows to which RapidMiner attribute the column type of your database will be transformed.

    Can you show the select statement and the schema of your tables? Maybe we could find out then which type is causing the problem here and maybe this can be solved by simply adding it to the type definitions shown above.

    Thanks,
    Ingo
  • Options
    nicugeorgiannicugeorgian Member Posts: 31 Maven
    Hello Ingo,

    thanks for the answer.

    The query is simply: SELECT * FROM RM_INPUTDATA

    Here's the (somehow simplified) design of the table RM_INPUTDATA:

    Attribute1: Number (Double)
    Attribute2: Text (size 3)
    Attribute3: Text (size 2)
    Attribute4: Text (size 12)
    Attribute5: Text (size 5)
    Attribute7: Text (size 8)

    This is the typical message I get (at console) for every table record: 

    attribute1 --> String: '3243', Int: '3243', Double: '3243.0', Missing: 'false'
    . . .
    attribute4 --> String: 'GREC 'Cannot read database data: Fail to convert to internal representation [class java.sql.SQLException]Cannot read database data: Fail to convert to internal representation [class java.sql.SQLException], Missing: 'false'
    . . .

    Here, attribute4 is defined of type Text (of size 12), but its value has the length 4. Could this be a problem?  :-\

    Cheers,
    Geo
  • Options
    IngoRMIngoRM Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,751 RM Founder
    Ahhh, now I see  :D

    I missed the point that you used RM 4.1beta (taken from the other topic). There was a debug message in this beta version which is removed in the final version 4.1 which tried to convert each field to a string, to a double, to an integer independently of the actual column type. So the line

    attribute1 --> String: '3243', Int: '3243', Double: '3243.0', Missing: 'false'
    was produced by something like

    System.out.println(attributeName + "--> String: " + resultSet.getString(col) + ", Int: " + resultSet.getInt(col)....);
    The error message just tells that it is not possible to get a number from a text. So nothing wrong here: it was just a debug output in the beta version which is gone now. Just update to the latest version and you will no longer get these messages.

    Cheers,
    Ingo
  • Options
    nicugeorgiannicugeorgian Member Posts: 31 Maven
    mierswa wrote:


    The error message just tells that it is not possible to get a number from a text. So nothing wrong here: it was just a debug output in the beta version which is gone now. Just update to the latest version and you will no longer get these messages.

    Now it's clear  :) I have updated to the latest version.

    Many thanks Ingo!
Sign In or Register to comment.