Hi again,

I have still the problem with iBatis 2.2.0 . 

My problem is with a stored procedure in Sybase returning multi result set. In 
the class com.ibatis.sqlmap.engine.execution.SqlExecutor from Clinton, there is 
a call to getFirstResultSet which call moveToNextResultsIfPresent.

The program crashes (with the strange "SybSQLException: Incorrect syntax near 
the keyword 'from'.") when accessing for the 5th time stmt.getUpdateCount(), 
each previous call having return "1", indicating there were more results to 
"getFirstResultSet".

I think it may be a problem with the JDBC driver, has anybody been confronted 
to this problem?

Thanks!
Cyril


Here is the code from SqlExecutor:

  private ResultSet getFirstResultSet(Statement stmt) throws SQLException {
    ResultSet rs = null;
    boolean hasMoreResults = true;
    while (hasMoreResults) {
      rs = stmt.getResultSet();
      if (rs != null) {        //** Cyril: Always null before the crash
        break;
      }
      hasMoreResults = moveToNextResultsIfPresent(stmt);
    }
    return rs;
  }

  private boolean moveToNextResultsIfPresent(Statement stmt) throws 
SQLException {
    boolean moreResults;
    // This is the messed up JDBC approach for determining if there are more 
results
    moreResults = !(((moveToNextResultsSafely(stmt) == false) && 
(stmt.getUpdateCount() == -1))); //** Cyril: The getUpdateCount crashes here, 
the 5th time
    return moreResults;
  }




----- Message d'origine ----
De : Cyril <[EMAIL PROTECTED]>
À : [email protected]
Envoyé le : Mardi, 19 Septembre 2006, 10h12mn 42s
Objet : Re : Problem when executing stored procedure "Incorrect syntax near the 
keyword"

It seems that this stored procedure has a multi-result set result. The version 
of iBatis we are currently using doesn't work with such procedure, but I see 
the latest release supports this functionnality.

Time to update our version of iBatis !

Cyril

----- Message d'origine ----
De : Cyril <[EMAIL PROTECTED]>
À : [email protected]
Envoyé le : Lundi, 18 Septembre 2006, 6h02mn 31s
Objet : Problem when executing stored procedure "Incorrect syntax near the 
keyword"

Hi!

I'm migrating an application from an internal JDBC framework to iBatis. 
Currently, a lot of the business work is done in stored procedure, so I just 
need to call the stored procedures from DAO with iBatis.

Until now, I hadn't any major issue, but when calling a particular stored 
procedure, I was stucked with an SQLException with my sqlMap.queryForList.  The 
exception is:

com.sybase.jdbc2.jdbc.SybSQLException: Incorrect syntax near the keyword 'from'.

(my data base is Sybase)

It doesn't look an iBatis problem, but when I call the same procedure with the 
same parameters from JDBC  or from my SQL client, everything is ok.

My iBatis sql map file contains:


<resultMap id="deliveryDetailResult" 
class="com.calyon.ccc.ibatis.pojo.DeliveryUtilizationLineFromDatabase">
        <result property="id" column="Id"/>
        <result property="amount" column="Utilisation"/>
        <result property="keyName" column="KeyName"/>
        <result property="authorizationId" column="KeyValue"/>
        <result property="utilizationDate" column="Date"/>
</resultMap>

<procedure id="getDetailedDeliveryUtilizations2" 
resultMap="deliveryDetailResult">
        <![CDATA[
            {call CCCGetDeliveryUtilization("TODAY", "Profile", "Client", 
"1234567890", "All", "N")}
        ]]>
</procedure>


It's just a procedure call, there is no "from" in it. Since I can call the 
stored procedure with these parameters from JDBC or SQL client, I assume there 
is also no problem in the stored procedure (which contains "from").

My DAO looks like:
List result = null;
try {
      result = sqlMap.queryForList("getDetailedDeliveryUtilizations2", new 
ArrayList());
} catch (SQLException sqle) {
       LOGGER.error("SQLException " + sqle.getMessage(), sqle);
}

Since I traced with the debugger quite deep in iBatis, I can't understand the 
problem. It should not come from iBatis, but does somebody have an idea?

Thanks,
Cyril Gambis









Reply via email to