Uploaded image for project: 'OJB'
  1. OJB
  2. OJB-26

JDBC-ODBC bridge problem

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 1.0.3
    • 1.0.4
    • PB-API
    • None
    • ODBC (MDAC 2.8)
      JDBC-ODBC bridge
      SQL Server

    Description

      Hi,

      OJB is not compatible with JDBC-ODBC Bridge.

      ODBC complains about an "invalid descriptor index" when accessing data from a ResultSet.
      It seems that the order used to access the ResultSet data is not the same as the one used to create the SQL query.

      ex :
      SELECT col1, col2, col3 FROM table;
      => ojb is trying to read col3 then odbc fails;

      Can OJB developpers fill me with some JDBC driver type 2 or type 3
      that are compatible with OJB 1.0.1 to 1.0.3 ?

      Here is the log trace from jdbc-odbc bridge :

      *Connection.prepareStatement (SELECT A0.VERSION,A0.MAX_KEY,A0.GRAB_SIZE,A0.TABLENAME,A0.FIELDNAME FROM OJB_HL_SEQ A0 WHERE A0.TABLENAME = ?)
      Allocating Statement Handle (SQLAllocStmt), hDbc=431038872
      hStmt=431039416
      Setting statement option (SQLSetStmtOption), hStmt=431039416, fOption=6, vParam=0
      Setting statement option (SQLSetStmtOption), hStmt=431039416, fOption=7, vParam=1
      Preparing (SQLPrepare), hStmt=431039416, szSqlStr=SELECT A0.VERSION,A0.MAX_KEY,A0.GRAB_SIZE,A0.TABLENAME,A0.FIELDNAME FROM OJB_HL_SEQ A0 WHERE A0.TABLENAME = ?
      Number of parameter markers (SQLNumParams), hStmt=431039416
      value=1
      Registering Statement sun.jdbc.odbc.JdbcOdbcPreparedStatement@15b28d8
      Binding IN string parameter (SQLBindParameter), hStmt=431039416, ipar=1, SQLtype=12, precision=8000, scale=0, rgbValue=[B@1b4df9c
      *PreparedStatement.executeQuery
      *PreparedStatement.execute
      Free statement (SQLFreeStmt), hStmt=431039416, fOption=0
      Executing (SQLExecute), hStmt=431039416
      Number of result columns (SQLNumResultCols), hStmt=431039416
      value=5
      Number of result columns (SQLNumResultCols), hStmt=431039416
      value=5
      Fetching (SQLFetch), hStmt=431039416
      *ResultSet.getMetaData
      Number of result columns (SQLNumResultCols), hStmt=431039416
      value=5
      *ResultSetMetaData.getColumnName (1)
      Column attributes (SQLColAttributes), hStmt=431039416, icol=1, type=1
      value (String)=VERSION
      Number of result columns (SQLNumResultCols), hStmt=431039416
      value=5
      *ResultSetMetaData.getColumnName (2)
      Column attributes (SQLColAttributes), hStmt=431039416, icol=2, type=1
      value (String)=MAX_KEY
      Number of result columns (SQLNumResultCols), hStmt=431039416
      value=5
      *ResultSetMetaData.getColumnName (3)
      Column attributes (SQLColAttributes), hStmt=431039416, icol=3, type=1
      value (String)=GRAB_SIZE
      Number of result columns (SQLNumResultCols), hStmt=431039416
      value=5
      *ResultSetMetaData.getColumnName (4)
      Column attributes (SQLColAttributes), hStmt=431039416, icol=4, type=1
      value (String)=TABLENAME
      Number of result columns (SQLNumResultCols), hStmt=431039416
      value=5
      *ResultSetMetaData.getColumnName (5)
      Column attributes (SQLColAttributes), hStmt=431039416, icol=5, type=1
      value (String)=FIELDNAME
      Column attributes (SQLColAttributes), hStmt=431039416, icol=5, type=2
      value (int)=12
      Column attributes (SQLColAttributes), hStmt=431039416, icol=5, type=3
      value (int)=70
      Get string data (SQLGetData), hStmt=431039416, column=5, maxLen=71
      deprecatedColumn
      Column attributes (SQLColAttributes), hStmt=431039416, icol=4, type=2
      value (int)=12
      Column attributes (SQLColAttributes), hStmt=431039416, icol=4, type=3
      value (int)=175
      Get string data (SQLGetData), hStmt=431039416, column=4, maxLen=176
      RETCODE = -1
      ERROR - Generating SQLException...
      SQLException: SQLState(S1002) vendor code(0)
      java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]invalid descriptor index
      at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
      at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
      at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(Unknown Source)
      at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(Unknown Source)
      at sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
      at sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
      at org.apache.ojb.broker.util.JdbcTypesHelper$T_Varchar.readValueFromResultSet(Unknown Source)
      at org.apache.ojb.broker.util.JdbcTypesHelper$BaseType.getObjectFromColumn(Unknown Source)
      at org.apache.ojb.broker.util.JdbcTypesHelper$BaseType.getObjectFromColumn(Unknown Source)
      at org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readValuesFrom(Unknown Source)
      at org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readPkValuesFrom(Unknown Source)
      at org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(Unknown Source)
      at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source)
      at org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown Source)
      at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown Source)
      at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown Source)
      at org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.lookupStoreSequence(Unknown Source)
      at org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getSequence(Unknown Source)
      at org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getUniqueLong(Unknown Source)
      at org.apache.ojb.broker.util.sequence.AbstractSequenceManager.getUniqueValue(Unknown Source)
      at org.apache.ojb.broker.util.BrokerHelper.setAutoIncrementValue(Unknown Source)
      at org.apache.ojb.broker.util.BrokerHelper.getValuesForObject(Unknown Source)
      at org.apache.ojb.broker.util.BrokerHelper.getKeyValues(Unknown Source)
      at org.apache.ojb.broker.Identity.init(Unknown Source)
      at org.apache.ojb.broker.Identity.<init>(Unknown Source)
      at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source)
      at com.is2france.framework.middleware.services.IssosPersistenceBrokerImpl.store(IssosPersistenceBrokerImpl.java:52)
      at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown Source)
      at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown Source)

      ....
      /* business code */
      ....

      *ResultSet.close

      N.B: this trace occurs when ojb is trying to retrieve a new id from the sequence generator table. But it happens on the rest of application.

      Attachments

        Activity

          People

            Unassigned Unassigned
            vietk Viet Kévin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: