+ Reply to Thread
Results 1 to 8 of 8

Thread: UnableToObtainConnectionException when doing Login

  1. #1
    Member
    Join Date
    Jul 2012
    Posts
    35
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Lightbulb UnableToObtainConnectionException when doing Login

    Hello,

    I am facing this problem when trying to do login from my client on my ElectroServer installed on my localhost.
    ElectroServer console is showing this stack trace :

    ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ***********
    org.skife.jdbi.v2.exceptions.UnableToObtainConnect ionException: org.apache.commons.dbcp.SQLNestedException:
    Cannot create PoolableConnectionFactory (Access denied for user 'admin'@'localhost' (using password: YES))
    ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** ***********


    my database.properties contents are as following:



    # Database properties are the properties defined at
    database.driverClassName=com.mysql.jdbc.Driver

    # Specify the url for MySQL,
    database.url=jdbc:mysql://localhost:3306/MYDATABASE

    # Specify a valid MySQL username and password.
    database.username=admin
    database.password=PASSWORD


    Has it something to do with the port no. "3306"?
    Suggest me how to fix this.

  2. #2
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,284
    Thanks
    81
    Thanked 1,093 Times in 1,082 Posts
    Do you have MySQL installed? Do you have it set so that TCP/IP connections are enabled? If you run MySQL from the command line, can you log on using admin and PASSWORD as given in your database.properties, and see the MYDATABASE database?

    If you can log in but not see MYDATABASE database, make sure that you have created the database, and also done "grant all" for that username. If you aren't familiar with "grant all" check the MySQL manual.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  3. #3
    Member
    Join Date
    Jul 2012
    Posts
    35
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Hi Teresa,

    Yup i have mysql installed on my system. I can login with my username password from mysql console. and i can see MYDATABASE in database list.
    I have default phpmyadmin account for mysql username "root" and pass "" , so by default it has all the privileges.

    No idea about TCP/IP connection enabling. How to check it?

  4. #4
    Member
    Join Date
    Jul 2012
    Posts
    35
    Thanks
    9
    Thanked 0 Times in 0 Posts
    When i dont create extensions in electroserver such as CONTROLLER FACTORY, DBLOGIN HANDLER, GMS INITIALIZER , INIT PLUGIN , then i can easily do login into electro server, but its of no use as it doesnt gives proper login responses.
    And when i add these extension handlers then i get to face dese problems mentioned above

  5. #5
    Member
    Join Date
    Jul 2012
    Posts
    35
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Hey Teresa , i got it fixed , actaully i had kept password "" which i thought was representing blank string. but it was actually "" so it was not allowing the root to do login.
    Thanks for help buddy.

  6. #6
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,284
    Thanks
    81
    Thanked 1,093 Times in 1,082 Posts
    The problem is that we just need to get your MySQL configured properly. Once we get that done, the extension should work correctly.

    I mentioned the TCP/IP part because when MySQL is running on Windows, that has to be enabled or ES5 can't access it, even locally. I don't remember needing to do anything with that for Linux, and the only thing that turned up googling was instructions for how to enable it if you need remote access to the database.

    I'm not sure that the database.properties bit will work if you set the password to "". Try creating a user in MySQL with a password (or giving root a password that isn't "") and then editing database.properties to use that MySQL user. You will need to grant all. When I add a new MySQL user I use 4 commands:
    Code:
    CREATE USER 'name'@'localhost' IDENTIFIED BY 'password';
    GRANT ALL ON mydatabase.* TO 'name'@'localhost';
    CREATE USER 'name'@'%' IDENTIFIED BY 'password';
    GRANT ALL ON mydatabase.* TO 'name'@'%';
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  7. #7
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,284
    Thanks
    81
    Thanked 1,093 Times in 1,082 Posts
    Glad to hear you got it fixed! I thought the problem might have been that blank password.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  8. #8
    Member
    Join Date
    Jul 2012
    Posts
    35
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Thanks buddy ! Seriously, a sigh of relief to me . I wasted my 7-8 hours in understanding n fixing it up. Anyhow, got to learn a lot because of it

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts