Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (u

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jethro
    New Member
    • Jun 2014
    • 1

    Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (u

    This is my first JSP application using mysql database connection. My application is reporting this error: "Cannot create PoolableConnect ionFactory (Access denied for user 'root'@'localho st' (using password: YES))".

    This is what my script look like:

    Code:
    [U][B]context.xml:[/B][/U]
    <Context antiJARLocking="true" path="/5GMODS"> <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
         maxActive="100" maxIdle="30" maxWait="10000" removeAbandoned="true"
         username="root" password="jethro" driverClassName="com.mysql.jdbc.Driver"
         url="jdbc:mysql://127.0.0.1:3306/erata" /> </Context>
    
    [U][B]web.xml:[/B][/U]
    <resource-ref> <description>DB Connection Pool</description> <res-ref-name>jdbc/TestDB</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref>
    
    [I][B][B]TestDBConnection java class:[/B][/B][/I]
    public boolean isValid()
        {
    
            // Get a connection from the pool
            
    
             try
             {
                  pool = (DataSource)ctx.lookup("java:comp/env/jdbc/TestDB");
                  conn = pool.getConnection();
                
                 if (pool != null)
                 {
                    return true;
               
                 }
                else
                {
                     err="Unknown DataSource 'jdbc/TestDB'";
                     return false;
                }
            }
            catch(Exception e)
            {
                //System.out.println(e);
                 err=e.getMessage();
                 return false;
            } 
            
    
               //return status;
           
        }
    I am actually using the mysql server in wamp. From the command prompt, i am successful connecting to the mysql server as root(username) and jethro(password ). It just not working with my application. Please help me to forge ahead with this project.
    Last edited by Rabbit; Jun 22 '14, 06:16 AM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • manageknowledge
    New Member
    • Jun 2014
    • 10

    #2
    Is the port 3306 correct?

    Comment

    Working...