users@glassfish.java.net

Re: What are GF requirements for creating JDBC connection ..

From: Noah White <emailnbw_at_gmail.com>
Date: Sat, 5 Oct 2013 23:52:16 -0400

My environment is Mac OS X 10.8.5 w/Oracle JDK 1.8.0-EA-b109 and to test this out I just downloaded the GF 4.0 ZIP distribution (promoted build 3 but you could grab any I'm sure), and MySQL 5.6.14 64bit DMG (Mac OS X) and unzipped GF into my home directory and ran the MySQL installer from the DMG.

I connected to MySQL w/the cmd line tool and created a test db like so:

mysql> create database test2;
Query OK, 1 row affected (0.00 sec)

mysql> grant usage on *.* to jdbcGF_at_localhost identified by 'jdbc';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on test2.* to jdbcGF_at_localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> exit

Then I downloaded the MySQL connector/J JDBC driver (5.1.26), unzipped it and placed the driver JAR into domains/domain1/lib.

Then I started domain1 from a terminal app: ./asadmin start-domain

Then I went and created a JDBC Connection pool in the admin GUI with the following configuration:

Pool name: BuilderDBPool
Resource Type: javax.sql.DataSource
Database vendor: MySQL
(clicked Next button)

Under additional properties (and there were a lot) I set the following:

URL and Url to:
jdbc:mysql://localhost:3306/test2

Password: jdbc
User: jdbcGF

That's all, I left everything else alone.

I clicked Finish and the did a ping and it worked just fine. This whole process took less then 5 minutes (took longer to type this).

Looking at your domain.xml I see your URL string is wrong. The last part is the DB name so change it to:

jdbc:mysql://localhost:3306/test

See the docs here [2] for details on the driver configuration properties.

My domain.xml jdbc-connection-pool also came out a lot longer then yours (which GF version are you using, which Connector J version are you using?). If you want to compare I pasted it here [3].

And FWIW this isn't my forum, I'm just another GF user like you trying to lend you a hand. I agree that the forum software sucks (as does java.net). For example, it's nearly impossible for me to read your posts since the forum software mangles them when they are mirrored into the gf users mailing list that I am reading them from.

-Noah

[1] - http://www.catb.org/esr/faqs/smart-questions.html#beprecise
[2] - http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html
[3] - http://pastebin.com/jQzga2f7

On Oct 5, 2013, at 6:40 PM, forums_at_java.net wrote:

> Thank you for considering me a complete idiot who does not understand that
> database name, user and password have to be valid. This gives me ping error:
> An error has occurred Ping Connection Pool failed for blanketBuilderDBPool.
> Connection could not be allocated because: Access denied for user
> 'jdbcGF'@'localhost' (using password: YES) Please check the server.log for
> more details. An error has occurred Ping Connection Pool failed for
> blanketBuilderDBPool. Connection could not be allocated because: Access
> denied for user 'jdbcGF'@'localhost' (using password: YES) Please check the
> server.log for more details. Now if we connected with the same parameters on
> the command line, they would work fine. $ mysql --host=10.10.10.2
> --user=jdbcGF --password=jdbc Welcome to the MySQL monitor. Commands end with
> ; or \g. Your MySQL connection id is 31234 Server version: 5.5.8 MySQL
> Community Server (GPL) Copyright (c) 2000, 2011, Oracle and/or its
> affiliates. All rights reserved. Oracle is a registered trademark of Oracle
> Corporation and/or its affiliates. Other names may be trademarks of their
> respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the
> current input statement. mysql> use test Reading table information for
> completion of table and column names You can turn off this feature to get a
> quicker startup with -A Database changed mysql> select * from test.color;
> +----------+----------+-----+-------+------+ | color_id | color | red | green
> | blue | +----------+----------+-----+-------+------+ | 1 | White | 255 | 255
> | 255 | | 2 | Yellow | 255 | 255 | 0 | | 3 | Pink | 250 | 105 | 180 | | 4 |
> Red | 255 | 0 | 0 | +----------+----------+-----+-------+------+ 4 rows in
> set (0.00 sec) mysql> So how does it sound now? [quote=emailnbw]It sounds
> like your connection pool properties are misconfigured for your environment
> or you haven't got MySQL setup correctly. Have you created the DB with the
> correct user and password in MySQL prior to pinging it from the connection
> pool? Can you access the DB using that user name and password from the mysql
> cmd line tool from the mysql distro? If you can get that far check your
> connection pool properties to make sure they are also in good shape. Those
> are in the In the "Additional properties" tab of the JDBC Connection Pools
> area in the admin GUI for your blankeyBuilderDBPool. Also, if you open
> $GF_HOME/glassfish/domains1/domain1/config/domain.xml and find the with the
> pool-name attr of your pool and the with the name attr of the associated
> jdbc-resource and copy/paste them to the list and we can help verify your
> settings. -Noah On Sat, Oct 5, 2013 at 9:22 AM, wrote: > New error: Ping
> Connection Pool failed for blanketBuilderDBPool. Connection > could not be
> allocated because: Access denied for user 'jdbcGB'@ > 'localhost' > (using
> password: YES) Please check the server.log for more details. GF is >
> appending @'localhost' to the user name and that fails the logins. What >
> now? > > > -- > > [Message sent by forum member 'ajeh'] > > View Post:
> http://forums.java.net/node/**899077 > > >[/quote]
>
> --
>
> [Message sent by forum member 'ajeh']
>
> View Post: http://forums.java.net/node/899077
>
>