You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by ju...@house-keeping.com on 2005/04/07 13:58:18 UTC

problem configuring context resource in Tomcat 5.0 for mysql connector/j


Im having problems with setting up a database connection pool with mysql
connector/j.

I follow the example code in the how-twos. My problem is that Tomcat seems to
pickup my resource and its parameters (kind of)! I would like to connect to a
database that is not on localhost. So in the url paremeter I use:

    <parameter>
      <name>url</name>
      <value>jdbc:mysql://<IP_Address>:3306/javatest?autoReconnect=true</value>
    </parameter>



However, when I run the test example I get:

Access denied for user: 'javauser@<Tomcat_Machine_IP_address>' (Using password:
YES)

When I replace the IP address with duff text ie. "blahblah" I then get the error
that blahblah is a n unknownhost exception, which I expect.

This is driving me bonkers and I bet its something simple, I just cant see
it!!!!

I have been reading many articles on the net and I have tried a variety of
combinations but to no success! Arrhh!

Setup;

1) Im using the mysql connector/j drivers
2) Using Tomcat 5.0
3) On windows XP (Dev!) which will be deployed to redhat eventually!
4) Using the example on the Tomcat website, I moved the context out of:
CATALINA_HOME\conf\server.xml to:
CATALINA_HOME\conf\Catalina\localhost\DBTest.xml it behaves the same in both
cases.


Many thanks in advance.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: problem configuring context resource in Tomcat 5.0 for mysql connector/j

Posted by ju...@house-keeping.com.
Doug,

You are a saint! I had set the wrong ip address set for the mysql user. I feel a
little stupid for overlooking this.

It reminded of a problem I encountered when I first started working - could not
figure out why I could not get onto the company network, tried everything!
Turned out the cable had not been plugged in correctly!!

Many thanks, my friend.

Carl.




Quoting Parsons Technical Services <pa...@earthlink.net>:

> You need to setup the user in the database. If you log into the database and
> switch to the mysql database. The do a select * from users you will see the
> users are defined with either localhost, %, or an IP. You will need to have
> the javauser setup to use the % (anywhere) or better the IP of the Tomcat
> machine.
>
> OR the user does not have rights to the database you are trying to access.
>
> Doug
>
>
> ----- Original Message -----
> From: <ju...@house-keeping.com>
> To: <to...@jakarta.apache.org>
> Sent: Thursday, April 07, 2005 7:58 AM
> Subject: problem configuring context resource in Tomcat 5.0 for mysql
> connector/j
>
>
> >
> >
> > Im having problems with setting up a database connection pool with mysql
> > connector/j.
> >
> > I follow the example code in the how-twos. My problem is that Tomcat seems
> > to
> > pickup my resource and its parameters (kind of)! I would like to connect
> > to a
> > database that is not on localhost. So in the url paremeter I use:
> >
> >    <parameter>
> >      <name>url</name>
> >
> > <value>jdbc:mysql://<IP_Address>:3306/javatest?autoReconnect=true</value>
> >    </parameter>
> >
> >
> >
> > However, when I run the test example I get:
> >
> > Access denied for user: 'javauser@<Tomcat_Machine_IP_address>' (Using
> > password:
> > YES)
> >
> > When I replace the IP address with duff text ie. "blahblah" I then get the
> > error
> > that blahblah is a n unknownhost exception, which I expect.
> >
> > This is driving me bonkers and I bet its something simple, I just cant see
> > it!!!!
> >
> > I have been reading many articles on the net and I have tried a variety of
> > combinations but to no success! Arrhh!
> >
> > Setup;
> >
> > 1) Im using the mysql connector/j drivers
> > 2) Using Tomcat 5.0
> > 3) On windows XP (Dev!) which will be deployed to redhat eventually!
> > 4) Using the example on the Tomcat website, I moved the context out of:
> > CATALINA_HOME\conf\server.xml to:
> > CATALINA_HOME\conf\Catalina\localhost\DBTest.xml it behaves the same in
> > both
> > cases.
> >
> >
> > Many thanks in advance.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: problem configuring context resource in Tomcat 5.0 for mysql connector/j

Posted by Parsons Technical Services <pa...@earthlink.net>.
You need to setup the user in the database. If you log into the database and 
switch to the mysql database. The do a select * from users you will see the 
users are defined with either localhost, %, or an IP. You will need to have 
the javauser setup to use the % (anywhere) or better the IP of the Tomcat 
machine.

OR the user does not have rights to the database you are trying to access.

Doug


----- Original Message ----- 
From: <ju...@house-keeping.com>
To: <to...@jakarta.apache.org>
Sent: Thursday, April 07, 2005 7:58 AM
Subject: problem configuring context resource in Tomcat 5.0 for mysql 
connector/j


>
>
> Im having problems with setting up a database connection pool with mysql
> connector/j.
>
> I follow the example code in the how-twos. My problem is that Tomcat seems 
> to
> pickup my resource and its parameters (kind of)! I would like to connect 
> to a
> database that is not on localhost. So in the url paremeter I use:
>
>    <parameter>
>      <name>url</name>
> 
> <value>jdbc:mysql://<IP_Address>:3306/javatest?autoReconnect=true</value>
>    </parameter>
>
>
>
> However, when I run the test example I get:
>
> Access denied for user: 'javauser@<Tomcat_Machine_IP_address>' (Using 
> password:
> YES)
>
> When I replace the IP address with duff text ie. "blahblah" I then get the 
> error
> that blahblah is a n unknownhost exception, which I expect.
>
> This is driving me bonkers and I bet its something simple, I just cant see
> it!!!!
>
> I have been reading many articles on the net and I have tried a variety of
> combinations but to no success! Arrhh!
>
> Setup;
>
> 1) Im using the mysql connector/j drivers
> 2) Using Tomcat 5.0
> 3) On windows XP (Dev!) which will be deployed to redhat eventually!
> 4) Using the example on the Tomcat website, I moved the context out of:
> CATALINA_HOME\conf\server.xml to:
> CATALINA_HOME\conf\Catalina\localhost\DBTest.xml it behaves the same in 
> both
> cases.
>
>
> Many thanks in advance.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org