You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Rob Parker <ro...@webcybernetics.com> on 2000/03/14 07:58:49 UTC

SQLProcessor - MySQL - TEXT type fields problem

I'm using cocoon 1.7 with Apache/Jserv1.1 etc and MySql. I am
running a query on a 'TEXT' type column. The SQLProcessor seems
to return a Java object reference rather than the text. Any suggestions?

BTW the same code works fine if the column is of type 'varchar'....

Rob Parker
Technical Director
Web Cybernetics Pty Ltd
Level 3, IBM Tower
60 City Road
Southgate, Vic. 3006
Australia

Phone: +61 3 9626 2489
Fax:      +61 3 9699 5477
Mobile:   0419 135 193
e-mail:   robert@webcybernetics.com
Web:    www.webcybernetics.com

Re: SQLProcessor - MySQL - TEXT type fields problem

Posted by Russell Castagnaro <ru...@synctank.com>.
That's not the java id, its the binary representation of the data.  Using the
substring and converts it to a string.

Rob Parker wrote:

> Thanks for the suggestions, I have a work around, but not a reason yet.
> Further details below...
>
> I'm using mm.mysql-jdbc1.2b driver
> Win NT4 sp5
> MySQL Win32 3.22.32
>
> Below are the sample queries (and results) if I put through cocoon, if I run
> the queries through a standalone servlet, the output is fine. The
> description
> field is of type text.
>
> select description from product;
> [B@51bcf84a
>
> select substring(description,0) from product;
>
> select substring(description,1) from product;
> This is a good description
>
> ----- Original Message -----
> From: Donald Ball <ba...@webslingerZ.com>
> To: <co...@xml.apache.org>; <ru...@synctank.com>
> Sent: Wednesday, March 15, 2000 3:54 AM
> Subject: Re: SQLProcessor - MySQL - TEXT type fields problem
>
> > >
> > > > I'm using cocoon 1.7 with Apache/Jserv1.1 etc and MySql. I amrunning a
> query
> > > > on a 'TEXT' type column. The SQLProcessor seemsto return a Java object
> > > > reference rather than the text. Any suggestions? BTW the same code
> works fine
> > > > if the column is of type 'varchar'.... Rob Parker
> >
> > What kind of java object is it returning? which JDBC driver are you using?
> >
> > - donald
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

--

Russell Castagnaro
Chief Mentor
SyncTank Solutions
http://www.synctank.com

Earth is the cradle of mankind; one does not remain in the cradle forever
-Tsiolkovsky



Re: SQLProcessor - MySQL - TEXT type fields problem

Posted by Thorbjoern Ravn Andersen <ra...@mip.sdu.dk>.
On Wed, 15 Mar 2000, Rob Parker wrote:

> Thanks for the suggestions, I have a work around, but not a reason yet.
> Further details below...
> 
> I'm using mm.mysql-jdbc1.2b driver
> Win NT4 sp5
> MySQL Win32 3.22.32
> 
> Below are the sample queries (and results) if I put through cocoon, if I run
> the queries through a standalone servlet, the output is fine. The
> description
> field is of type text.
> 
> select description from product;
> [B@51bcf84a
> 
> select substring(description,0) from product;
> 
> select substring(description,1) from product;
> This is a good description

I have an identical behaviour with this snippet:


select items.id as id, 
       items.owner as owner, 
       ceiling(items.size/1024) as size, 
       items.entered as entered,
       to_days(items.entered) as tde,
       date_format( items.entered, "%Y-%m-%d %H:%i") as enteredformatted,
       mime.mimetype as mimetype,
       users.login as login
from items, mime, users
  where (year(entered) = {@y}) and
        (month(entered) = {@m}) and
        (items.mimeid = mime.mimeid) and
        (users.userid = items.owner)
order by tde desc, entered
<!-- sort reversibly by date and then chronologically in the day -->


which among a lot of other stuff produces:

<entered>2000-03-27 08:12:42.0</entered><tde>730571</tde><enteredformatted>[B@80d35f5</enteredformatted><mimetype>message/rfc822


The "entered" field is a datetime.  This got me the correct result just
before I made the query more complex by requesting information from
multiple tables and using "as" to name them simpler.

Best regards,
-- 
  Thorbjørn Ravn Andersen               "...plus...Tubular Bells!"
  http://www.mip.sdu.dk/~ravn


Re: SQLProcessor - MySQL - TEXT type fields problem

Posted by Rob Parker <ro...@webcybernetics.com>.
Thanks for the suggestions, I have a work around, but not a reason yet.
Further details below...

I'm using mm.mysql-jdbc1.2b driver
Win NT4 sp5
MySQL Win32 3.22.32

Below are the sample queries (and results) if I put through cocoon, if I run
the queries through a standalone servlet, the output is fine. The
description
field is of type text.

select description from product;
[B@51bcf84a

select substring(description,0) from product;

select substring(description,1) from product;
This is a good description


----- Original Message -----
From: Donald Ball <ba...@webslingerZ.com>
To: <co...@xml.apache.org>; <ru...@synctank.com>
Sent: Wednesday, March 15, 2000 3:54 AM
Subject: Re: SQLProcessor - MySQL - TEXT type fields problem


> >
> > > I'm using cocoon 1.7 with Apache/Jserv1.1 etc and MySql. I amrunning a
query
> > > on a 'TEXT' type column. The SQLProcessor seemsto return a Java object
> > > reference rather than the text. Any suggestions? BTW the same code
works fine
> > > if the column is of type 'varchar'.... Rob Parker
>
> What kind of java object is it returning? which JDBC driver are you using?
>
> - donald
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>


Re: SQLProcessor - MySQL - TEXT type fields problem

Posted by Donald Ball <ba...@webslingerZ.com>.
> 
> > I'm using cocoon 1.7 with Apache/Jserv1.1 etc and MySql. I amrunning a query
> > on a 'TEXT' type column. The SQLProcessor seemsto return a Java object
> > reference rather than the text. Any suggestions? BTW the same code works fine
> > if the column is of type 'varchar'.... Rob Parker

What kind of java object is it returning? which JDBC driver are you using?

- donald


Re: SQLProcessor - MySQL - TEXT type fields problem

Posted by Russell Castagnaro <ru...@synctank.com>.
Try selecting the text column using a substring.
if the columnis named col1
substring(col1,0).


Rob Parker wrote:

> I'm using cocoon 1.7 with Apache/Jserv1.1 etc and MySql. I amrunning a query
> on a 'TEXT' type column. The SQLProcessor seemsto return a Java object
> reference rather than the text. Any suggestions? BTW the same code works fine
> if the column is of type 'varchar'.... Rob Parker
> Technical Director
> Web Cybernetics Pty Ltd
> Level 3, IBM Tower
> 60 City Road
> Southgate, Vic. 3006
> Australia Phone: +61 3 9626 2489
> Fax:      +61 3 9699 5477
> Mobile:   0419 135 193
> e-mail:   robert@webcybernetics.com
> Web:    www.webcybernetics.com

--

Russell Castagnaro
Chief Mentor
SyncTank Solutions
http://www.synctank.com

Earth is the cradle of mankind; one does not remain in the cradle forever
-Tsiolkovsky