cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Franz <afra...@optushome.com.au>
Subject Re: DatabaseReader problem with 2.1.7, help needed (fwd)
Date Sun, 17 Jul 2005 07:26:56 GMT
Try Joerg's suggestion: i.e. Look at the actual exception

You can do this quickly & easily, outside Cocoon with JSTL/JSP as follows:

<c:catch var="exception">
    <sql:query var="qkpi" dataSource="${xdb}" maxRows="20" 
startRow="0">SELECT * FROM mytable</sql:query>
</c:catch>
<c:if test="${not empty exception}">
    *(dump exception here)*
</c:if>

The rest is as below.

After that, I'm out of suggestions


Tuomo L wrote:

> SQL Transformer works fine, so does ESQL and other stuff, only the 
> DatabaseReader fails when reading and serializing a binary column. 
> This is very bizarre. I've also tried putting the mime-type setting in 
> the component configuration, sitemap-invocation, the "content-type" 
> -parameter, "type-column", switched between JDK1.5/JDK1.4, 
> Tomcat4/Tomcat5.5, Cocoon2.1.5/Cocoon2.1.7 and all different 
> combinations of these. I also built the 2.1.7 from scratch as is, 
> without modifications but the SQL-driver in web.xml and 
> JDBC-configuration in cocoon.xconf to match SQL Server's needs. The 
> upload/download -sample does the same thing, returning 0 bytes.
>
> How could I debug this more?
>
> -Tuomo
>
> On Sun, 17 Jul 2005, Andrew Franz wrote:
>
>> I haven't used SQL server from C2.
>> All I can suggest is to keep on isolating the problem, e.g try the 
>> JDBC driver directly under Tomcat using JSP
>> e.g. try the following - put it under webapps/jsp-examples
>> (substitute driver & url accordingly, the following is for Oracle)
>>
>> If it works, the problem is your Cocoon setup or Cocoon. If not, the 
>> problem is the driver or JDBC setup.
>>
>> Sometimes I think that it would be quicker and easier to strip away 
>> *all* of the layers and go back to using the file system.
>>
>>
>> <?xml version="1.0"?>
>> <jsp:root version="1.2"
>>   xmlns:jsp="http://java.sun.com/JSP/Page"
>>   xmlns:c="http://java.sun.com/jsp/jstl/core"
>>   xmlns:sql="http://java.sun.com/jsp/jstl/sql">
>> <jsp:directive.page contentType="text/html"/>
>> <jsp:directive.page import="java.text.*"/>
>>
>> <sql:setDataSource var="xdb" driver="oracle.jdbc.driver.OracleDriver" 
>> url="jdbc:oracle:thin:@localhost:1521:dbname"  user="scott"  
>> password="tiger" />
>> <html>
>> <body>
>> <sql:query var="qkpi" dataSource="${xdb}" maxRows="20" 
>> startRow="0">SELECT * FROM mytable</sql:query>
>> <table border="1">
>> <c:forEach var="columnName" items="${qkpi.columnNames}"><td><c:out

>> value="${columnName}"/></td></c:forEach>
>> <c:forEach var="row" items="${qkpi.rowsByIndex}" varStatus="vs">
>>   <tr><c:forEach var="col" items="${row}"><td><c:out 
>> value="${col}"/></td></c:forEach></tr>
>> </c:forEach>
>> </table>
>> </body>
>> </html>
>> </jsp:root>
>>
>>
>> Tuomo L wrote:
>>
>>> Thanks, I tested the sample, and it does work with HSQLDB. But when 
>>> I tested it against SQL Server with similar results I got before: 
>>> Upload works but reading the file with DatabaseReader returns 0 
>>> bytes. :(
>>>
>>> So, my guess is, something has changed between 2.1.5 and 2.1.7 that 
>>> makes
>>> the JDBC driver for SQL Server incompatible with Cocoon. With the 
>>> jar-files from 2.1.5 (same setup otherwise) this works. What could 
>>> this change be?
>>>
>>> The method that throws this error "Assuming client reset stream" in 
>>> DatabaseReader.java is:
>>>
>>> public void generate() throws ProcessingException, SAXException, 
>>> IOException {
>>>         try {
>>>             Response response = 
>>> ObjectModelHelper.getResponse(objectModel);
>>>             this.serialize(response);
>>>         } catch (IOException ioe) {
>>>             getLogger().warn("Assuming client reset stream");
>>>
>>>             this.doCommit = false;
>>>         } catch (Exception e) {
>>>             this.doCommit = false;
>>>
>>>             throw new ResourceNotFoundException("DatabaseReader 
>>> error:", e);
>>>         }
>>>     }
>>>
>>>
>>> -Tuomo
>>>
>>> On Sun, 17 Jul 2005, Andrew Franz wrote:
>>>
>>>> DatabaseReader is used in the samples:
>>>> http://localhost:8080/cocoon/samples/blocks/databases/mod-db/file-upload-blob

>>>> (Cocoon 2.1.7, Tomcat 5.5)
>>>>
>>>> After upload, this uses DatabaseReader to retrieve the image from 
>>>> HSQLDB.
>>>> If this works ok, then the problems are with SQL Server maybe the 
>>>> column definition
>>>>
>>>>
>>>> Tuomo L wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Is anyone using the DatabaseReader with Cocooon 2.1.7 ? We just 
>>>>> cannot get
>>>>> it to function. Log says "Assuming client reset stream".
>>>>>
>>>>> If it works, could you please tell which versions of Java, Tomcat 
>>>>> and db you have on what system? We're trying to figure out the 
>>>>> source for this
>>>>> problem. With Cocoon 2.1.5 everything works fine. We are using SQL 
>>>>> Server
>>>>> 2000 and it's latest JDBC driver provided by MS.
>>>>>
>>>>> -Tuomo
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>
>>
>


Mime
View raw message