JDBC-ODBC bridge problem
------------------------

         Key: OJB-26
         URL: http://issues.apache.org/jira/browse/OJB-26
     Project: OJB
        Type: Bug
  Components: PB-API  
    Versions: 1.0.3    
 Environment: ODBC (MDAC 2.8)
JDBC-ODBC bridge
SQL Server
    Reporter: Viet K�vin
    Priority: Blocker


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 [EMAIL PROTECTED]
Binding IN string parameter (SQLBindParameter), hStmt=431039416, ipar=1, 
SQLtype=12, precision=8000, scale=0, [EMAIL PROTECTED]
*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.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to