ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Javier Leyba" <xle...@gmail.com>
Subject MySQL query problem
Date Fri, 20 Oct 2006 08:44:01 GMT
Hi

I've the following code defined:

----------------
<select id="insertTopic" parameterClass="topic"
                resultClass="genericResult">
                <![CDATA[
                        INSERT INTO topic (
                        topic.topic_id,
                        topic.topic_description
                        ) VALUES (#id#, #description#);
                 SELECT ROW_COUNT() AS result;
         ]]>
        </select>
----------------------


This insert was working in a stored procedure without problems. Now I
extracted from stored procedure and inserted as an iBatis select but
when I run it I got the error:

---------------------
2006-10-20 10:37:34,331 :DEBUG
:[http-0.0.0.0-8088-1]:taCommonsLoggingImpl: {conn-100000} Connection
2006-10-20 10:37:34,367 :DEBUG
:[http-0.0.0.0-8088-1]:taCommonsLoggingImpl: {conn-100000} Preparing
Statement:        INSERT INTO topic (               topic.topic_id,
           topic.topic_description         ) VALUES (?, ?);   SELECT
ROW_COUNT() AS result
2006-10-20 10:37:34,494 :DEBUG
:[http-0.0.0.0-8088-1]:taCommonsLoggingImpl: {pstm-100001} Executing
Statement:        INSERT INTO topic (               topic.topic_id,
           topic.topic_description         ) VALUES (?, ?);   SELECT
ROW_COUNT() AS result
2006-10-20 10:37:34,494 :DEBUG
:[http-0.0.0.0-8088-1]:taCommonsLoggingImpl: {pstm-100001} Parameters:
[mastres, Otro topic mas]
2006-10-20 10:37:34,496 :DEBUG
:[http-0.0.0.0-8088-1]:taCommonsLoggingImpl: {pstm-100001} Types:
[java.lang.String, java.lang.String]
2006-10-20 10:37:34,545 :ERROR
:[http-0.0.0.0-8088-1]:sPortSoapBindingImpl: insertTopic(TopicBean)
Exception en first try
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in Topic.xml.
--- The error occurred while applying a parameter map.
--- Check the insertTopic-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: java.sql.SQLException: You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near ';             SELECT ROW_COUNT() AS
result' at line 1
Caused by: java.sql.SQLException: You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near ';             SELECT ROW_COUNT() AS
result' at line 1
        at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:185)
        at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:104)
        at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:565)
        at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:540)
        at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
        at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:84)
        at com.bs.proteo.notifications.service.NotificationsPortSoapBindingImpl.insertTopic(NotificationsPortSoapBindingImpl.java:972)
        at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown
Source)
        at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown
Source)
        at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
        at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
        at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
        at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
Caused by: java.sql.SQLException: You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near ';             SELECT ROW_COUNT() AS
result' at line 1
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2921)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1570)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:2978)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:930)
        at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:770)
        at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.execute(WrappedPreparedStatement.java:183)
        at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown
Source)

------------------


Log show me that parameters arrives to query without problems. If I
put those querys in a MySQL it works ok, so..... I' ve no idea about
the origin of the error and how to fix it.

Could somebody give me a clue ?

Thanks in advance

J





-- 
Javier Leyba
Barcelona - Spain
http://blog.leyba.com.ar

Mime
View raw message