You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Zack Angelo <za...@nostromocorp.com> on 2002/05/02 04:54:58 UTC

Cocoon generated Java throwing SQLException

Hey,

I'm having some really peculiar behavior with the ESQL logicsheet. I
have the following XSP (in my own logicsheet):

<esql:query> select ID,count(ID) as count from Users where
LoginUser='zack' and Password='password' group by ID</esql:query>

The corresponding Java seems to be generating just fine: 

_esql_query = new EsqlQuery( _esql_connection, String.valueOf("select
ID,count(ID) as count from Users where LoginUser='zack' and
Password='password' group by ID") );

But, upon execution, I get this exception:

org.apache.cocoon.ProcessingException: Exception in
ServerPagesGenerator.generate(): java.lang.RuntimeException: Error
executing statement: select ID,count(ID) as count from Users where
LoginUser='zack' and Password='password' group by ID:
java.sql.SQLException: Column not found: Unknown column 'LoginUser' in
'where clause'

For some reason it's saying that one of the columns doesn't exist...I
have no idea why. I've also copied and pasted the SQL query from the
Java into the mysql client, and it works fine. Any ideas? This just
seems really strange to me. Thanks in advance.

-Zack Angelo
 Nostromo Corporation




---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Cocoon generated Java throwing SQLException

Posted by Zack Angelo <za...@nostromocorp.com>.
On 5/2/02 2:26 AM, "Christian Haul" <ha...@dvs1.informatik.tu-darmstadt.de>
wrote:

> On 01.May.2002 -- 09:54 PM, Zack Angelo wrote:
>> Hey,
>> 
>> I'm having some really peculiar behavior with the ESQL logicsheet. I
>> have the following XSP (in my own logicsheet):
>> 
>> <esql:query> select ID,count(ID) as count from Users where
>> LoginUser='zack' and Password='password' group by ID</esql:query>
>> 
>> The corresponding Java seems to be generating just fine:
>> 
>> _esql_query = new EsqlQuery( _esql_connection, String.valueOf("select
>> ID,count(ID) as count from Users where LoginUser='zack' and
>> Password='password' group by ID") );
>> 
>> But, upon execution, I get this exception:
>> 
>> org.apache.cocoon.ProcessingException: Exception in
>> ServerPagesGenerator.generate(): java.lang.RuntimeException: Error
>> executing statement: select ID,count(ID) as count from Users where
>> LoginUser='zack' and Password='password' group by ID:
>> java.sql.SQLException: Column not found: Unknown column 'LoginUser' in
>> 'where clause'
>> 
>> For some reason it's saying that one of the columns doesn't exist...I
>> have no idea why. I've also copied and pasted the SQL query from the
>> Java into the mysql client, and it works fine. Any ideas? This just
>> seems really strange to me. Thanks in advance.
> 
> It seems to be a problem with the mySQL jdbc driver. I believe we had
> another user reporting similar problems with mySQL. I *think* a solution
> was using only lower case coulmn names. According to the SQL standard,
> case does not matter because everything is converted to uppercase internally,
> except for strings within quotes.
> 
> If the table belongs to another user / schema, you might need to qualify it
> with the user name.
> 
> Please check with a small java program that the driver is OK.
> 
> HTH.
> 
> Chris.

Chris, 

Yeah, I've written entire applications with the mm mySQL driver before. I'm
pretty certain it works. The lower-case solution also comes off a little
strange because I've written a small XSP script (the one you helped me with
before) and it worked great (also had capitalized column names).

I also tried changing the user to root in the esql connection pool, still no
good.  Thanks for the input.

- Zack



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Cocoon generated Java throwing SQLException

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 01.May.2002 -- 09:54 PM, Zack Angelo wrote:
> Hey,
> 
> I'm having some really peculiar behavior with the ESQL logicsheet. I
> have the following XSP (in my own logicsheet):
> 
> <esql:query> select ID,count(ID) as count from Users where
> LoginUser='zack' and Password='password' group by ID</esql:query>
> 
> The corresponding Java seems to be generating just fine: 
> 
> _esql_query = new EsqlQuery( _esql_connection, String.valueOf("select
> ID,count(ID) as count from Users where LoginUser='zack' and
> Password='password' group by ID") );
> 
> But, upon execution, I get this exception:
> 
> org.apache.cocoon.ProcessingException: Exception in
> ServerPagesGenerator.generate(): java.lang.RuntimeException: Error
> executing statement: select ID,count(ID) as count from Users where
> LoginUser='zack' and Password='password' group by ID:
> java.sql.SQLException: Column not found: Unknown column 'LoginUser' in
> 'where clause'
> 
> For some reason it's saying that one of the columns doesn't exist...I
> have no idea why. I've also copied and pasted the SQL query from the
> Java into the mysql client, and it works fine. Any ideas? This just
> seems really strange to me. Thanks in advance.

It seems to be a problem with the mySQL jdbc driver. I believe we had
another user reporting similar problems with mySQL. I *think* a solution
was using only lower case coulmn names. According to the SQL standard,
case does not matter because everything is converted to uppercase internally,
except for strings within quotes.

If the table belongs to another user / schema, you might need to qualify it
with the user name.

Please check with a small java program that the driver is OK.

HTH.

	Chris.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>