You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Fredy Provoste <fr...@gmail.com> on 2007/09/19 06:26:04 UTC

Question about JNDI + Connection Pool + Mysql (Tomcat 6)

Hi again, i've been deployed a webapp called "libreria" in Tomcat 6, i tried
to configure a mysql connection pool, so in the path

libreria
.
.........  META-INF/context.xml

put the lines

<Context path="/libreria" docBase="libreria"  debug="5" privileged="true"
reloadable="true">

<Resource name="jdbc/basededatos" auth="Container" type="
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"
factory="com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory"
driverClassName="com.mysql.jdbc.Driver"  username="usuarioweb"
password="usuarioweb"
url="jdbc:mysql://localhost:3306/prueba1?autoReconnect=true"/>

</Context>



in  the path

libreria
.
............WEB-INF/web.xml

the lines to use the JNDI resource


<resource-ref>
      <description>
        Pool a la Base de Datos
      </description>
      <res-ref-name>
        jdbc/basededatos
      </res-ref-name>
      <res-type>
        com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
      </res-type>
      <res-auth>
        Container
      </res-auth>
  </resource-ref>


so trying using JSTL, and pure JSP to access the pool, i get the next
message

ERROR java.sql.SQLException: Access denied for user ''@'localhost' (using
password: YES)
seems like tomcat ignores my user i've created in mysql server (I verify the
connection through dreamweaver conection feature and it works)

thanks for any help

Fredy

Re: Question about JNDI + Connection Pool + Mysql (Tomcat 6)

Posted by Titi Wangsa <bl...@gmail.com>.
try changing
username="usuarioweb"
to
user="usuarioweb"

from
http://www.docjar.com/docs/api/com/mysql/jdbc/jdbc2/optional/MysqlDataSource.html#setUser(java.lang.String)


On 9/19/07, Fredy Provoste <fr...@gmail.com> wrote:
> Hi again, i've been deployed a webapp called "libreria" in Tomcat 6, i tried
> to configure a mysql connection pool, so in the path
>
> libreria
> .
> .........  META-INF/context.xml
>
> put the lines
>
> <Context path="/libreria" docBase="libreria"  debug="5" privileged="true"
> reloadable="true">
>
> <Resource name="jdbc/basededatos" auth="Container" type="
> com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"
> factory="com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory"
> driverClassName="com.mysql.jdbc.Driver"  username="usuarioweb"
> password="usuarioweb"
> url="jdbc:mysql://localhost:3306/prueba1?autoReconnect=true"/>
>
> </Context>
>
>
>
> in  the path
>
> libreria
> .
> ............WEB-INF/web.xml
>
> the lines to use the JNDI resource
>
>
> <resource-ref>
>       <description>
>         Pool a la Base de Datos
>       </description>
>       <res-ref-name>
>         jdbc/basededatos
>       </res-ref-name>
>       <res-type>
>         com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
>       </res-type>
>       <res-auth>
>         Container
>       </res-auth>
>   </resource-ref>
>
>
> so trying using JSTL, and pure JSP to access the pool, i get the next
> message
>
> ERROR java.sql.SQLException: Access denied for user ''@'localhost' (using
> password: YES)
> seems like tomcat ignores my user i've created in mysql server (I verify the
> connection through dreamweaver conection feature and it works)
>
> thanks for any help
>
> Fredy
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Question about JNDI + Connection Pool + Mysql (Tomcat 6)

Posted by Steve Ochani <oc...@ncc.edu>.
Date sent:	Wed, 19 Sep 2007 00:26:04 -0400
From:	Fredy Provoste <fr...@gmail.com>
Subject:	Question about JNDI + Connection Pool + Mysql (Tomcat 6)
To:	Tomcat User List <us...@tomcat.apache.org>
Send reply to:	Tomcat Users List <us...@tomcat.apache.org>

> Hi again, i've been deployed a webapp called "libreria" in Tomcat 6, i
> tried to configure a mysql connection pool, so in the path
> 
> libreria
> .
> .........  META-INF/context.xml
> 
> put the lines
> 
> <Context path="/libreria" docBase="libreria"  debug="5"
> privileged="true" reloadable="true">
> 
> <Resource name="jdbc/basededatos" auth="Container" type="
> com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"
> factory="com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory"
> driverClassName="com.mysql.jdbc.Driver"  username="usuarioweb"
> password="usuarioweb"
> url="jdbc:mysql://localhost:3306/prueba1?autoReconnect=true"/>
> 
> </Context>
> 
> 
> 
> in  the path
> 
> libreria
> .
> ............WEB-INF/web.xml
> 
> the lines to use the JNDI resource
> 
> 
> <resource-ref>
>       <description>
>         Pool a la Base de Datos
>       </description>
>       <res-ref-name>
>         jdbc/basededatos
>       </res-ref-name>
>       <res-type>
>         com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
>       </res-type>
>       <res-auth>
>         Container
>       </res-auth>
>   </resource-ref>
> 
> 
> so trying using JSTL, and pure JSP to access the pool, i get the next
> message
> 
> ERROR java.sql.SQLException: Access denied for user ''@'localhost'
> (using password: YES) seems like tomcat ignores my user i've created
> in mysql server (I verify the connection through dreamweaver conection
> feature and it works)
> 

That error is from mysql server and it doesn't mean that the password that was used was 
"YES"  it just means that a password was used. The password that was used will not be 
logged.

Make sure you have an account on mysql server as 
usuarioweb@localhost

which is different than

usuarioweb@'%'

Test it by loggin in from local machine.

-Steve O.




> thanks for any help
> 
> Fredy
> 



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Question about JNDI + Connection Pool + Mysql (Tomcat 6)

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Mikolaj Rydzewski [mailto:miki@ceti.pl] 
> Subject: Re: Question about JNDI + Connection Pool + Mysql (Tomcat 6)
> 
> > <Context path="/libreria" docBase="libreria"  debug="5" 
> > privileged="true" reloadable="true">
>  
> You should not use path attribute in META-INF/context.xml.

Nor docBase, for that matter.  But removing those is not likely to solve
the OP's problem, although it's always good to get the obvious errors
cleaned up.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Question about JNDI + Connection Pool + Mysql (Tomcat 6)

Posted by Mikolaj Rydzewski <mi...@ceti.pl>.
Fredy Provoste wrote:
> Hi again, i've been deployed a webapp called "libreria" in Tomcat 6, i tried
> to configure a mysql connection pool, so in the path
>
> libreria
> .
> .........  META-INF/context.xml
>
> put the lines
>
> <Context path="/libreria" docBase="libreria"  debug="5" privileged="true"
> reloadable="true">
>   
You should not use path attribute in META-INF/context.xml.

-- 
Mikolaj Rydzewski <mi...@ceti.pl>