Hello, all:

I am not sure whether cocoon 1.8 (Turbine engine) can work with MS Access databbase? Anyway, I did the stpes following:

1. add a new database driver into cocoon.properties file:

    # These properties are used by the DBFactory.
    processor.xsp.pool.database.adaptor=DBWeblogic,DBOracle,DBInstantDB,DBPostgres,DBSybase,DBInformix,DBODBC
    processor.xsp.pool.database.adaptor.DBWeblogic=weblogic.jdbc.pool.Driver
    processor.xsp.pool.database.adaptor.DBOracle=oracle.jdbc.driver.OracleDriver
    processor.xsp.pool.database.adaptor.DBInstantDB=org.enhydra.instantdb.jdbc.idbDriver
    processor.xsp.pool.database.adaptor.DBPostgres=postgresql.Driver
    processor.xsp.pool.database.adaptor.DBInformix=com.informix.jdbc.IfxDriver
    processor.xsp.pool.database.adaptor.DBSybase=com.sybase.jdbc.SybDriver
   
    # ODBC driver added
    processor.xsp.pool.database.adaptor.DBODBC=sun.jdbc.odbc.JdbcOdbcDriver
    processor.xsp.pool.database.DBODBC.url="">    processor.xsp.pool.database.DBODBC.username=dbUser
    processor.xsp.pool.database.DBODBC.password=dbPass
    processor.xsp.pool.database.DBODBC.maxConnections=3
    processor.xsp.pool.database.DBODBC.expiryTime=3600000

2. compose a xsp file below:

<?cocoon-process type="xsp"?>
<?xml-logicsheet href=""?>
<?cocoon-process type="xslt"?>

<xsp:page language="java" create-session="true"
          xmlns:xsp="http://www.apache.org/1999/XSP/Core"
          xmlns:sql="http://www.apache.org/1999/SQL"
          xmlns:request="http://www.apache.org/1999/XSP/Request">

  <page title="SQL Search Results">
 
  <sql:execute-query>
            <sql:use-connection>DBODBC</sql:use-connection>
            <sql:skip-rows>0</sql:skip-rows>
            <sql:max-rows>50</sql:max-rows>
            <sql:null-indicator>y</sql:null-indicator>
            <sql:count-attribute>BOB</sql:count-attribute>
            <sql:doc-element>ROWSET</sql:doc-element>
            <sql:row-element>ROW</sql:row-element>
            <sql:tag-case>preserve</sql:tag-case>
            <sql:id-attribute>ID</sql:id-attribute>
            <sql:query>
               SELECT * FROM tabell1
           </sql:query>
        </sql:execute-query>
  
 </page>

</xsp:page>

3. then when I use IE browser to access the file, the error message shows:

Error found handling the request.

java.lang.NullPointerException
 at org.apache.cocoon.processor.xsp.library.sql.XSPSQLLibrary.processQuery(XSPSQLLibrary.java, Compiled Code)
 at org.apache.cocoon.processor.xsp.library.sql.XSPSQLLibrary.executeQuery(XSPSQLLibrary.java:101)
 at _D_._Program._Apache._jakarta_tomcat._webapps._cocoon._sql._mytaglib.populateDocument(_mytaglib.java, Compiled Code)
 at org.apache.cocoon.processor.xsp.XSPPage.getDocument(XSPPage.java:96)
 at org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java, Compiled Code)
 at org.apache.cocoon.Engine.handle(Engine.java, Compiled Code)
 at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
 at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java, Compiled Code)
 at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
 at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java, Compiled Code)
 at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java, Compiled Code)
 at java.lang.Thread.run(Unknown Source)

4. I try to find errors, then I go to the reposit subdirector to find the generated java file, and try to compile it in command line and succeed.
 
the database url and the jdbc2odbc are runnable in my java program before, but now with cocoon I do have no idea what to do. anyone who setup jdbc2odbc to access MS Access database?
 
5, Then I try ESQL to do so:
 
<xsp:page language="java" create-session="true"
   xmlns:xsp="http://www.apache.org/1999/XSP/Core"
          xmlns:esql="http://apache.org/cocoon/SQL/v2"
          xmlns:request="http://www.apache.org/1999/XSP/Request">
 
  <PAGE>
 
    <TITLE>StoX - Login</TITLE>
 
    <xsp:logic>
         <esql:execute-query>
              <esql:use-connection>DBODBC</esql:use-connection>
              <esql:query>
                select * from CUSTOMERS
              </esql:query>
              <esql:results>
                <ID><esql:get-string column="ID"/></ID>
                <FN><esql:get-string column="First_Name"/></FN>
              </esql:results>
              <esql:no-results>
                <error>no results were found</error>
                <xsp:expr>response.sendRedirect(response.encodeURL("login.xml"));</xsp:expr>
              </esql:no-results>
            </esql:execute-query>
    </xsp:logic>
 
  </PAGE>
</xsp:page>
 
But worse more, it seems cocoon do not accept esql taglib at all. here is the returned error message:

Error found handling the request.

org.apache.cocoon.processor.ProcessorException: Could not associate stylesheet to document:  no matching stylesheet for: explorer
	at org.apache.cocoon.processor.xslt.XSLTProcessor.getResource(XSLTProcessor.java, Compiled Code)
	at org.apache.cocoon.processor.xslt.XSLTProcessor.process(XSLTProcessor.java:107)
	at org.apache.cocoon.Engine.handle(Engine.java, Compiled Code)
	at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
	at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java, Compiled Code)
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
	at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java, Compiled Code)
	at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java, Compiled Code)
	at java.lang.Thread.run(Unknown Source)
I am a little urgent about it, any comment is appreciated.
thanks a lot
 
 

Reply via email to