Link to home
Start Free TrialLog in
Avatar of umar1farooq
umar1farooqFlag for Denmark

asked on

jdbc driver problem

Hi,

I have following problem, please can some body tell what happend
to jdbc dirver,

06.13 14:20:39 255] : [Warn] thread [Thread-42] class
[MessageClass] Unable to process message [50128630] reason [oracle.jdb
c.dbaccess.DBDataSetImpl._createOrGetDBItem(DBDataSetImpl.java:825)
oracle.jdbc.dbaccess.DBDataSetImpl.setBytesBindItem(DBDataSetImpl.java:2469)
oracle.jdbc.driver.OraclePreparedStatement.setItem(OraclePreparedStatement.java:1205)
oracle.jdbc.driver.OraclePreparedStatement.setLong(OraclePreparedStatement.java:1559)
mypackage.database.LoggablePreparedStatement.setLong(LoggablePreparedStatement.java:158)
Avatar of Acton Wang
Acton Wang
Flag of United States of America image

show me your related java code.
Avatar of umar1farooq

ASKER


The code in class LoggablePreparedStatement

public void setLong(int parameterIndex, long x) throws SQLException {
        ensureCapacity(parameterIndex);
        this.parameters[parameterIndex] = new Long(x);
        stmt.setLong(parameterIndex, x);
    }

 private void ensureCapacity(int i) {
        if(i >= parameters.length) {
            // extend capacity
            Object[] tmp = new Object[parameters.length * 2];
            System.arraycopy(parameters, 0, tmp, 0, parameters.length);
            parameters = tmp;
        }
    }
>> stmt.setLong(parameterIndex, x);

      how do you get the statement?


also what " SQLException" you get if that is the error? The message you show is just a [WARN] message. What stacktrace you got when error occurs?


In our log files i found only this, nothing else,

06.13 14:20:39 255] : [Warn] thread [Thread-42] class
[MessageClass] Unable to process message [50128630] reason [oracle.jdb
c.dbaccess.DBDataSetImpl._createOrGetDBItem(DBDataSetImpl.java:825)
oracle.jdbc.dbaccess.DBDataSetImpl.setBytesBindItem(DBDataSetImpl.java:2469)
oracle.jdbc.driver.OraclePreparedStatement.setItem(OraclePreparedStatement.java:1205)
oracle.jdbc.driver.OraclePreparedStatement.setLong(OraclePreparedStatement.java:1559)
mypackage.database.LoggablePreparedStatement.setLong(LoggablePreparedStatement.java:158)

Why it is gone To oracle.jdbc.driver.OraclePreparedStatement.setLong(OraclePreparedStatement.java:1559
from my LoggablePreparedStatement.setLong method ?
I think it is not handled by oracle.jdbc.driver.
The code in class LoggablePreparedStatement, This class is very big, i am adding only related methods to this problem,
 Query to stmt is set from other class,

PreparedStatement stmt = null;
    String statement = null;
    Connection con = null;
   
    public LoggablePreparedStatement(Connection con, String statement)
        throws SQLException {

          if (con == null ) {
                String vErrorMsg = "LoggablePreparedStatement.constructor. Passed connection == null";
                CheckedConnectionPool.makeLogMessageError ("LoggablePreparedStatement", vErrorMsg, null, null);                
                throw new NullPointerException (vErrorMsg);
          }      
          
        this.con = con;
       
        // Notice that instances of  the con variable should have, in fact, the PooledConnection type,
        // so prepareStatement to be called is from PooledConnection as well.
       
        this.stmt = con.prepareStatement(statement);
        this.statement = statement;
    }

    public void addBatch() throws SQLException {
        stmt.addBatch();
    }

public void setLong(int parameterIndex, long x) throws SQLException {
        ensureCapacity(parameterIndex);
        this.parameters[parameterIndex] = new Long(x);
        stmt.setLong(parameterIndex, x);
    }

 private void ensureCapacity(int i) {
        if(i >= parameters.length) {
            // extend capacity
            Object[] tmp = new Object[parameters.length * 2];
            System.arraycopy(parameters, 0, tmp, 0, parameters.length);
            parameters = tmp;
        }
    }
ASKER CERTIFIED SOLUTION
Avatar of Acton Wang
Acton Wang
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The stack trace code is given below.
Try {

 }catch (Exception e) {
             StackTraceElement[] elements = e.getStackTrace();
             StringBuffer buf = new StringBuffer();
             for (int a=0;a<elements.length;a++) {
                 buf.append(elements[a]).append("\n");
             }
             long mid = -1;
             if (message != null) {
                 mid = message.getId();
             }
             log.warn("Unable to process message [" + mid + "] reason [" + buf.toString() + "]");
             // add the exception to the list of exceptions occurred
             m_exceptions.addElement(e);
          }

and the following is coming in the  stack trace,
06.13 14:20:39 255] : [Warn] thread [Thread-42] class
[MessageClass] Unable to process message [50128630] reason [oracle.jdb
c.dbaccess.DBDataSetImpl._createOrGetDBItem(DBDataSetImpl.java:825)
oracle.jdbc.dbaccess.DBDataSetImpl.setBytesBindItem(DBDataSetImpl.java:2469)
oracle.jdbc.driver.OraclePreparedStatement.setItem(OraclePreparedStatement.java:1205)
oracle.jdbc.driver.OraclePreparedStatement.setLong(OraclePreparedStatement.java:1559)
mypackage.database.LoggablePreparedStatement.setLong(LoggablePreparedStatement.java:158)

The query is very simple,
 public static final String DELETE_SQL = "DELETE FROM MT_MESSAGE_QUEUE WHERE id = ?";
add this below:

 log.warn("Unable to process message [" + mid + "] reason [" + buf.toString() + "]");

 log.warn("exception: ",e);

what do you see?
It will take some time, to install changes to production,
This problem occured only on production.
somehow, you missed the error message .. so I am not sure what problem you have.