Hello Omar,
Try test JDBC connection this way:
<xsp:structure>
<xsp:include>org.apache.avalon.excalibur.datasource.DataSourceComponent</xsp:include>
</xsp:structure>
...
<xsp:logic><![CDATA[
try {
ComponentSelector selector = (ComponentSelector)
manager.lookup(DataSourceComponent.ROLE + "Selector");
DataSourceComponent datasource = (DataSourceComponent)
selector.select("test_mysql_pool");
Connection connection = datasource.getConnection();
PreparedStatement stmt = connection.prepareStatement("SELECT * FROM test");
stmt.execute();
if(stmt.getResultSet().next())
System.out.println("ok");
else
System.out.println("no results");
catch(Exception e) {
System.out.println("error: " + e.getMessage());
}
]]></xsp:logic>
and check catalina.out :)
Second possiblity: esql:connection can't be top element after
xsp:page and this is the reason of Your problem.
Tuesday, November 8, 2005, 11:19:13 PM, you wrote:
OA> Good Morning to all,
OA> I'm having some problems in using ESQL... really I can't yet use it...
OA> I'm trying to use mySQL database on cocoon 2.1.7 running under Tomcat
OA> 5.5.9 on a Windows XP machine...
OA> I'have done all the steps I need (maybe I think):
OA> 1) I have putted the connector-j to the $COCOON$/WEB-INF/lib directory
OA> 2) added to the $COCOON$/WEB-INF/cocoon.xconfig the following code
OA> <datasources>
OA> <jdbc name="test_mysql_pool">
OA> <pool-controller min="5" max="10"/>
OA> <auto-commit>true</auto-commit>
OA> <dburl>jdbc:mysql://localhost:3306/prova</dburl>
OA> <user>root</user>
OA> <password></password>
OA> </jdbc>
OA> </datasources>
OA> Yes, my DB is called prova and has no password (it's just a test db)
OA> 3) Added to $COCOON$/WEB-INF/web.xml the following code:
OA> <init-param>
OA> <param-name>load-class</param-name>
OA> <param-value>
OA> com.mysql.jdbc.Driver
OA> </param-value>
OA> </init-param>
OA> then I have written a XSP page with the following code:
OA> <?xml version="1.0" encoding="ISO-8859-1"?>
OA> <xsp:page language="java"
OA> xmlns:xsp="http://apache.org/xsp"
OA> xmlns:esql="http://apache.org/cocoon/SQL/v2"
>>
OA> <esql:connection>
OA> <esql:pool>test_mysql_pool</esql:pool>
OA> <esql:execute-query>
OA> <esql:query>SELECT * FROM test</esql:query>
OA> <esql:results>
OA> <table>
OA> <esql:row-results>
OA> <tr>
OA> <td><esql:get-string column="cognome"/></td>
OA> <td><esql:get-string column="nome"/></td>
OA> </tr>
OA> </esql:row-results>
OA> </table>
OA> </esql:results>
OA> <esql:error-results>
OA> Error:<br/>
OA> <esql:get-message/>
OA> <esql:to-string/>
OA> <esql:get-stacktrace/>
OA> </esql:error-results>
OA> <esql:no-results>
OA> <p>Sorry, no results!</p>
OA> </esql:no-results>
OA> </esql:execute-query>
OA> </esql:connection>
OA> </xsp:page>
OA> Now, my question is: There is any mistake in my configuration? Why I
OA> cant' have back any message also if I'm using the tags between
OA> <esql:error-results>??
OA> I hope to be clear, if not, please ask me for what's not understandable!
OA> Thanks in advice,
OA> Omar
OA> ---------------------------------------------------------------------
OA> To unsubscribe, e-mail: [EMAIL PROTECTED]
OA> For additional commands, e-mail: [EMAIL PROTECTED]
--
Best regards,
Grzegorz mailto:[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]