cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian P Millett <...@ec-group.com>
Subject Question SQLProcessor
Date Tue, 29 Feb 2000 22:57:14 GMT
Lets see, I have the following:

SunOS vlad 5.7 Generic_106541-08 sun4u sparc SUNW,Ultra-5_10,
Apache/1.3.11 (Unix) ApacheJServ/1.1 mod_perl/1.21
secured_by_Raven/1.4.1
Solaris VM (build Solaris_JDK_1.2.2_05, native threads, sunwjit)
Cocoon-1.7
Informix 9.1.14
Informix jdbc v2_10_jc1

I was getting the following error when I tried to do a simple query to
the database to get:
"Select * from customer where state='CA'"

java.sql.SQLException: Not in transaction.
 at java.lang.Throwable.fillInStackTrace(Native Method)
 at java.lang.Throwable.fillInStackTrace(Compiled Code)
 at java.lang.Throwable.<init>(Compiled Code)
 at java.lang.Exception.<init>(Compiled Code)
 at java.sql.SQLException.<init>(SQLException.java:43)
 at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:308)
 at com.informix.jdbc.IfxSqli.errorDone(IfxSqli.java:3109)
 at com.informix.jdbc.IfxSqli.receiveError(IfxSqli.java:2982)
 at com.informix.jdbc.IfxSqli.dispatchMsg(Compiled Code)
 at com.informix.jdbc.IfxSqli.receiveMessage(Compiled Code)
 at com.informix.jdbc.IfxSqli.executeRollback(IfxSqli.java:451)
 at com.informix.jdbc.IfxSqliConnect.rollback(IfxSqliConnect.java:979)
 at org.apache.cocoon.processor.sql.SQLProcessor.processQuery(Compiled
Code)
 at org.apache.cocoon.processor.sql.SQLProcessor.process(Compiled Code)
 at org.apache.cocoon.Engine.handle(Compiled Code)
 at org.apache.cocoon.Cocoon.service(Cocoon.java:145)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
 at
org.apache.jserv.JServConnection.processRequest(JServConnection.java:314)

 at org.apache.jserv.JServConnection.run(JServConnection.java:188)
 at java.lang.Thread.run(Thread.java:479)

Now, I did not find a "begin work" or setAutoCommit(false) statement.
Now, Oracle & postgreSQL do not generate a SQLException if you do a
commit() when not inside of a transaction.  I guess Informix is more
particular.

But, if I apply the following patch to move the commit() up to the
update area, I can use Informix to do simple queries.  I don't know
about more complex statements because I have not tried them yet.



vlad: diff -w3c SQLProcessor.java SQLProcessor.java.orig
*** SQLProcessor.java   Tue Feb 29 16:06:14 2000
--- SQLProcessor.java.orig      Tue Feb 29 16:05:01 2000
***************
*** 240,246 ****
                  int update_rows = st.executeUpdate(query);
                  if (results_element != null)

results_element.setAttribute(update_rows_attribute,""+update_rows);
-                 conn.commit();
              } else {
                  rs = st.executeQuery(query);
                  ResultSetMetaData md = rs.getMetaData();
--- 240,245 ----
***************
*** 304,310 ****
                  rs.close();
              }
              st.close();
!             //conn.commit();

query_element.getParentNode().replaceChild(results_node,query_element);
          } catch (SQLException e) {
              Element error_element =
Utils.createErrorElement(document,namespace,query_props,e);
--- 303,309 ----
                  rs.close();
              }
              st.close();
!             conn.commit();

query_element.getParentNode().replaceChild(results_node,query_element);
          } catch (SQLException e) {
              Element error_element =
Utils.createErrorElement(document,namespace,query_props,e);

My question is, is this just a cheep bandaid ???

Thanks

--
Brian Millett
Enterprise Consulting Group     "Heaven can not exist,
(314) 205-9030                     If the family is not eternal"
bpm@ec-group.com                   F. Ballard Washburn




Mime
View raw message