Search code examples
unixodbcibm-integration-bus

IIB node exit with no response MYSQL ODBC datasoruce


I'm trying to get ODBC working with IIB 10 but my node exit with no response when calling state.select. I believe something is wrong with my ODBC setup. The syslog don't show any error and the debugger crashes on the state.select

This is my code:

    try {
     outP = new PrintWriter(new BufferedWriter(new FileWriter("/tmp/myfile.txt", true)));
outP.println("Start");
        MbSQLStatement state = createSQLStatement( "MYSQL", 
            "SET OutputRoot.XMLNS.integer[] = PASSTHRU('SELECT * FROM " + "test" + "');" );

         state.select( inAssembly, newAssembly );

    } catch (Exception e) {
    outP.println(e);
    outP.flush();
    outP.close();
}

Result : The myfile.txt only contains the text "Start" the catch is never run

My ODBC settings

$odbcinst -j
unixODBC 2.3.4

DRIVERS............: /home/ds/iib-10.0.0.13/ie02/etc/odbcinst.ini
SYSTEM DATA SOURCES: /home/ds/iib-10.0.0.13/ie02/etc/odbc.ini
FILE DATA SOURCES..: /home/ds/iib-10.0.0.13/ie02/etc/ODBCDataSources
USER DATA SOURCES..: /home/ds/iib-10.0.0.13/server/ODBC/unixodbc/odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8

[MySQL]
Description=MySQL driver
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc8w.so
Setup=/usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
TraceFile = /tmp/sql.log

[MYSQL]
Description=MYSQL DB
Driver=MySQL
Database=test
Server=127.0.0.1
Port=3306

Solution

  • Try setting the attribute setThrowExceptionOnDatabaseError to true.

    state.setThrowExceptionOnDatabaseError(true);
    

    If a database error occurs during the execution of this statement, the behavior is determined by the value of the 'throwExceptionOnDatabaseError' attribute. If set to true (the default value), an exception gets thrown which can be caught if run within a try/catch block

    (source)