You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by beichuang <be...@yahoo.com> on 2000/10/17 17:03:38 UTC

Help for Cocoon 1.8 & MS. Access database!!!

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=jdbc:odbc:MyDBTest
    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="resource://org/apache/cocoon/processor/xsp/library/sql/esql.xsl"?>
<?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



Correct a mistake comment with JDBC/ODBC and another further question!!

Posted by beichuang <be...@yahoo.com>.
hello, all

I verified the Cocoon1.8 & JDBC/ODBC bridge class and Turbine engine again this morning, and here is my final result:

The adaptor name DBOdbc is no use, as to why I succeed yesterday, maybe I didn't update two cocoon.properties file both in webapp directory below tomcat director "tomcat/webapp/cocoon.properties" and my new example directory "webapp/mysamples/cocoon.properties".

So it means you have to change a line like this to fool Turbine to load JDBC/ODBC java class:

#a trick to replace informix driver with jdbc2odbc driver
#  processor.xsp.pool.database.adaptor.DBInformix=com.informix.jdbc.IfxDriver
processor.xsp.pool.database.adaptor.DBInformix=sun.jdbc.odbc.JdbcOdbcDriver

However, I find that if I just define driver in xsp file instead of using tag <esql:use-connection>MyDBOdbc</esql:use-connection>:

<esql:execute-query>
<esql:driver>sun.jdbc.odbc.JdbcOdbcDriver</esql:driver>
<esql:dburl>jdbc:odbc:MyDBTest</esql:dburl>
<esql:username>test</esql:username>
<esql:password>test</esql:password>
         <esql:query>
                SELECT * FROM tabell1
          </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>
              </esql:no-results>
</esql:execute-query>

then, I won't bother to setup turbine engine in cocoon.properties file.
So I wonder what the difference is between using turbine engine or not? any outstanding advantages with turbine engine?

Addtionally, Now I wonder whether I can set a page-division to my request? Normally, if a sql request get too many records, I would rather get some fixed amount records each time, for example, just return 20 records once, but still I have to continue the query, is it easy to do with cocoon? I know one can get the whole records once, and just display some, but maybe it is not the best solution, anymore has comments about this? I think it very common, and maybe can be put into consideration earlier.

Best regards!



(Succeed!! Thank you all!!) Help for Cocoon 1.8 & MS. Access database!!!

Posted by beichuang <be...@yahoo.com>.
Thank you, Thank you all so much, I have solved the problems.

it seems both of your suggestion are right:
either override a false infoxmix or some not used database adapter name, or
add a new but can only be DBOdbc, even case censitive.

Then I think maybe can even not use turbine, just combine the driver in a
xsp file, isn't it?

As to why I failed last time, just because I didn't change the xsp file, the
DBODBC should be changed to DBOdbc, so it is a shame, :-)

Thank you so much, I didn't expect I can finish it so soon with your help,
anyway, I want to get some detailed documents about esql, but the link on
website cocoon homepage is false. Any other available?

Best Regards


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: (again) Help for Cocoon 1.8 & MS. Access database!!!

Posted by Brian P Millett <bp...@ec-group.com>.
beichuang wrote:

>      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)
>

This is an error being generated from the servlet that is generated from cocoon.  Check the file at
_D_._Program._Apache._jakarta_tomcat._webapps._cocoon._sql._mytaglib to see what is the problem.
Looks like the SQL could be bad, or the database is generating an error.

What does the xml look like?

What version of Cocoon are you using?  The latest from CVS will give you the newer turbine-pool jar
file

--
Brian Millett
Enterprise Consulting Group   "Shifts in paradigms
(314) 205-9030               often cause nose bleeds."
bpm@ec-group.com                           Greg Glenn




(again) Help for Cocoon 1.8 & MS. Access database!!!

Posted by beichuang <be...@yahoo.com>.
ok, now it is here:

# These are the supported jdbc-drivers and their adaptors.
# These properties are used by the DBFactory.
#processor.xsp.pool.database.adaptor=DBWeblogic,DBOracle,DBInstantDB,DBPostgres,DBSybase,DBInformix,DBOdbc

processor.xsp.pool.database.adaptor=DBOdbc
processor.xsp.pool.database.adaptor.DBOdbc=sun.jdbc.odbc.JdbcOdbcDriver


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.DBOdbc.url=jdbc:odbc:MyDBTest
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

But the error message is still the same:


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:160)
	at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java, Compiled Code)
	at java.lang.Thread.run(Unknown Source)

BTW, any documents about ESQL(the link is false on cocoon website)? and have you anyone run the jdbc2odbc with Microsoft Access successfully?

Thanks a lot, and thank you for ur last response.


(again) Help for Cocoon 1.8 & MS. Access database!!!

Posted by beichuang <be...@yahoo.com>.
ok, now it is here:

# These are the supported jdbc-drivers and their adaptors.
# These properties are used by the DBFactory.
#processor.xsp.pool.database.adaptor=DBWeblogic,DBOracle,DBInstantDB,DBPostgres,DBSybase,DBInformix,DBOdbc

processor.xsp.pool.database.adaptor=DBOdbc
processor.xsp.pool.database.adaptor.DBOdbc=sun.jdbc.odbc.JdbcOdbcDriver


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.DBOdbc.url=jdbc:odbc:MyDBTest
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

But the error message is still the same:


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:160)
	at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java, Compiled Code)
	at java.lang.Thread.run(Unknown Source)

BTW, any documents about ESQL(the link is false on cocoon website)? and have you anyone run the jdbc2odbc with Microsoft Access successfully?

Thanks a lot, and thank you for ur last response.


Re: Help for Cocoon 1.8 & MS. Access database!!!

Posted by Brian P Millett <bp...@ec-group.com>.
beichuang wrote:

> 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


What you need to do is the following: (Turbine is defined for the ODBC database to be DBOdbc)

processor.xsp.pool.database.adaptor=DBOdbc
processor.xsp.pool.database.adaptor.DBOdbc=sun.jdbc.odbc.JdbcOdbcDriver

processor.xsp.pool.database.DBODBC.driver=sun.jdbc.odbc.JdbcOdbcDriver
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


Remember that "processor.xsp.pool.database.<POOLNAME>.driver=" is the part to define the pool.

--
Brian Millett
Enterprise Consulting Group   "Shifts in paradigms
(314) 205-9030               often cause nose bleeds."
bpm@ec-group.com                           Greg Glenn



Correct a mistake comment with JDBC/ODBC and another further question!!

Posted by beichuang <be...@yahoo.com>.
hello, all

I verified the Cocoon1.8 & JDBC/ODBC bridge class and Turbine engine again this morning, and here is my final result:

The adaptor name DBOdbc is no use, as to why I succeed yesterday, maybe I didn't update two cocoon.properties file both in webapp directory below tomcat director "tomcat/webapp/cocoon.properties" and my new example directory "webapp/mysamples/cocoon.properties".

So it means you have to change a line like this to fool Turbine to load JDBC/ODBC java class:

#a trick to replace informix driver with jdbc2odbc driver
#  processor.xsp.pool.database.adaptor.DBInformix=com.informix.jdbc.IfxDriver
processor.xsp.pool.database.adaptor.DBInformix=sun.jdbc.odbc.JdbcOdbcDriver

However, I find that if I just define driver in xsp file instead of using tag <esql:use-connection>MyDBOdbc</esql:use-connection>:

<esql:execute-query>
<esql:driver>sun.jdbc.odbc.JdbcOdbcDriver</esql:driver>
<esql:dburl>jdbc:odbc:MyDBTest</esql:dburl>
<esql:username>test</esql:username>
<esql:password>test</esql:password>
         <esql:query>
                SELECT * FROM tabell1
          </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>
              </esql:no-results>
</esql:execute-query>

then, I won't bother to setup turbine engine in cocoon.properties file.
So I wonder what the difference is between using turbine engine or not? any outstanding advantages with turbine engine?

Addtionally, Now I wonder whether I can set a page-division to my request? Normally, if a sql request get too many records, I would rather get some fixed amount records each time, for example, just return 20 records once, but still I have to continue the query, is it easy to do with cocoon? I know one can get the whole records once, and just display some, but maybe it is not the best solution, anymore has comments about this? I think it very common, and maybe can be put into consideration earlier.

Best regards!



Re: Help for Cocoon 1.8 & MS. Access database!!!

Posted by Sylvain Wallez <wa...@free.fr>.
You cannot add a driver in Turbine that way !

The database name (DBSybase, DBOracle, etc) are used by Turbine to build
a class name. If that class does not exist, you cannot create
connections.

First of all, note that the ODBC driver exists in Turbine but is not
included in turbine-pool.jar. The main reason for that is that the
JDBC-ODBC bridge is not suitable for heavily multi-threaded environments
like a web server.

However, I once needed to use an Access database from Cocoon and I did a
trick to fool Turbine : select a database type that you do not use and
change its driver class to the JDBC-ODBC bridge.
Example :
processor.xsp.pool.database.adaptor.DBInformix=sun.jdbc.odbc.JdbcOdbcDriver

Now, Turbine thinks that the ODBC driver is an Informix database. Some
turbine features will not work properly, but they are not used in
Cocoon.

Note that the name of the pool has no relation to the type of the
database. You can keep "DBODBC" as your pool name.

Hope this helps, but remember : Access is not good for a webserver
back-end.

-Sylvain

> beichuang a écrit :
> 
> 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=jdbc:odbc:MyDBTest
> 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="resource://org/apache/cocoon/processor/xsp/library/sql/esql.xsl"?>
> <?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)

<snip/>

Re: Help for Cocoon 1.8 & MS. Access database!!!

Posted by Brian P Millett <bp...@ec-group.com>.
beichuang wrote:

> 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


What you need to do is the following: (Turbine is defined for the ODBC database to be DBOdbc)

processor.xsp.pool.database.adaptor=DBOdbc
processor.xsp.pool.database.adaptor.DBOdbc=sun.jdbc.odbc.JdbcOdbcDriver

processor.xsp.pool.database.DBODBC.driver=sun.jdbc.odbc.JdbcOdbcDriver
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


Remember that "processor.xsp.pool.database.<POOLNAME>.driver=" is the part to define the pool.

--
Brian Millett
Enterprise Consulting Group   "Shifts in paradigms
(314) 205-9030               often cause nose bleeds."
bpm@ec-group.com                           Greg Glenn



Correct a mistake comment with JDBC/ODBC and another further question!!

Posted by beichuang <be...@yahoo.com>.
hello, all

I verified the Cocoon1.8 & JDBC/ODBC bridge class and Turbine engine again this morning, and here is my final result:

The adaptor name DBOdbc is no use, as to why I succeed yesterday, maybe I didn't update two cocoon.properties file both in webapp directory below tomcat director "tomcat/webapp/cocoon.properties" and my new example directory "webapp/mysamples/cocoon.properties".

So it means you have to change a line like this to fool Turbine to load JDBC/ODBC java class:

#a trick to replace informix driver with jdbc2odbc driver
#  processor.xsp.pool.database.adaptor.DBInformix=com.informix.jdbc.IfxDriver
processor.xsp.pool.database.adaptor.DBInformix=sun.jdbc.odbc.JdbcOdbcDriver

However, I find that if I just define driver in xsp file instead of using tag <esql:use-connection>MyDBOdbc</esql:use-connection>:

<esql:execute-query>
<esql:driver>sun.jdbc.odbc.JdbcOdbcDriver</esql:driver>
<esql:dburl>jdbc:odbc:MyDBTest</esql:dburl>
<esql:username>test</esql:username>
<esql:password>test</esql:password>
         <esql:query>
                SELECT * FROM tabell1
          </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>
              </esql:no-results>
</esql:execute-query>

then, I won't bother to setup turbine engine in cocoon.properties file.
So I wonder what the difference is between using turbine engine or not? any outstanding advantages with turbine engine?

Addtionally, Now I wonder whether I can set a page-division to my request? Normally, if a sql request get too many records, I would rather get some fixed amount records each time, for example, just return 20 records once, but still I have to continue the query, is it easy to do with cocoon? I know one can get the whole records once, and just display some, but maybe it is not the best solution, anymore has comments about this? I think it very common, and maybe can be put into consideration earlier.

Best regards!