cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Hohls" <>
Subject Re: Mysql connection error
Date Wed, 13 Jul 2005 13:42:36 GMT

This makes sense, except for the "mysql client" part.

My MachineB is the equivalent of your Windows (except 
it runs Linux, but I assume that makes no difference); 
and my MachineA  is the equivalent of your chandra (and
also running mysql).

The only difference is that there is not a "mysql client"
running on MachineB - I am not the admin for this machine
and am not sure I can get a "mysql client" installed on it.
Is there any simple way to test the connection as you have 

AFAIK I have created the permissions for the user on the 
remote machine to  access your database - as per Step 5
in my post below.  (This is always the way I have done
it before but I have a nagging feeling there is now some 
subtle difference somewhere in the new setup..)


>>> 2005/07/13 03:16:05 PM >>>
I have Mysql running on Linux, on host Chandra.

I have the mysql client running on windows, host creatively named win2k.

If I log onto win2k and run:

mysql -uroot -ppasswd -h chandra

I get: Access denied for user: 'root@' (Using password: YES)

So, I logged onto chandra and did:

grant all privileges on *.* to root@ idenitifed by 'passwd';

Then I repeated the command from win2k, and it let me in to chandra.

Hope that makes sense.

So, have you set permissions for the user on the remote machine to 
access your database?

Regards, Upayavira

Derek Hohls wrote:
> Uh - if I try:
> ./mysql -u myname -ppasswd -h
> that gives me the error:
> Access denied for user "" 
> (machine A is where I have telnetted into [from MachineB]
> ... and is also where the database is located - this is in line 
> with the manual which states:
> "If mysql -u root test works but mysql -h your_hostname -u root 
> results in Access denied (where your_hostname is the 
> **actual hostname of the local host***),
> But I am trying to test the connection from machineB ??
> Thanks
> Derek
>>>> 2005/07/13 02:36:21 PM >>>
> Derek Hohls wrote:
>>Thanks for the heads-up.
>>I have now tried using the machine name as well... but with no
>>Re the second approach - this is not clear to me.  I would normally
>>telnet into the box, then run ./mysql -u myname -p to work with
>>sql.  However, my understanding is that when I do this I am 
>>essentially connecting to mysql from the localhost.  How do I connect
>>from the remote machine to the database server using the mysql 
>>command as you suggest?
> er, ./mysql -u myname -ppasswd -h hostname
> :-)
> Regards, Upayavira
>>>>> 2005/07/13 01:22:06 PM >>>
>>Could be that you need to grant authorisation by machine name not by IP. 
>>I've had struggles with that sort of thing before.
>>Best to debug this by trying to login to remote host just using the 
>>mysql command at the command line. Then, once you've got that working, 
>>you can scale up to doing it with Cocoon.
>>Regards, Upayavira
>>Derek Hohls wrote:
>>>I am struggling with getting a new server to communicate with a mySQL database
on another machine.
>>>The database and queries work fine, when running on machine A, where the database
is installed,
>>>as does the Cocoon application when running there.  
>>>However, when I try and emulate the Cocoon application on machine B 
>>>(same OS, same Cocoon version - Linux, C2.1.6),
>>>I get a null pointer exception that I cannot seem to solve.
>>>Here is what I have done.
>>>1. Copied the mysql-connector-java-3.1.7-bin.jar file to tomcat\webapps\cocoon\WEB-INF\lib\
>>>2. Added an entry in web.xml for "com.mysql.jdbc.Driver"
>>>3. Aded an entry in the cocoon.xconf for:
>>>	<jdbc name="mydb">
>>>		<pool-controller min="1" max="50"/>
>>>		<auto-commit>true</auto-commit>
>>>		<dburl>jdbc:mysql://</dburl>
>>>		<user>myuser</user>
>>>		<password>mypassword</password>
>>>	</jdbc>
>>>4. Restarted Cocoon
>>>5. Added a "myuser" entry to the mySQL user table on the database machine, with

>>>USE mysql;
>>>GRANT USAGE ON *.* to myuser@"" IDENTIFIED BY 'mypassword';
>>>GRANT SELECT ON mydbname.* to ffpreporter@"";
>>>(obviously I am using the actual IP address of Machine B)
>>>6.  The pipeline in question looks like:
>>><map:match pattern="testproject">
>>>   <map:generate src="sql.xml"/>
>>>   <!-- === SQL Connector ====  -->      
>>>   <map:transform type="sql">
>>>     <map:parameter name="use-connection" value="mydb"/>
>>>     <map:parameter name="show-nr-of-rows" value="true"/> 
>>>     <map:parameter name="clob-encoding" value="UTF-8"/> 
>>>   </map:transform> 
>>>   <map:serialize type="xml"/>
>>>7.  the SQL file contains:
>>><?xml version="1.0" encoding="UTF-8" ?> 
>>><sq2:execute-query xmlns:sq2="">
>>><sq2:query name="themes">
>>>8.  The stacktrace from Cocoon is a java.lang.NullPointerException;
>>>looking in the error.log reveals:
>>>ERROR   (2005-07-13) 12:40.11:694   [sitemap.transformer.sql] 
>>>(/cocoon/myapp/testproject) http-8080-Processor4/SQLTransformer.Query: Caught
a SQLException
>>>java.sql.SQLException: Failed to obtain connection. Made 5 attempts with 5000ms
>>>How do I go about trying to pin down why this is happening?

To unsubscribe, e-mail: 
For additional commands, e-mail: 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message