Set up Glassfish connection pool to talk to a database on a Ubuntu VPS

On my Ubuntu VPS, i have a mysql server running and a Glassfish 3.0.1 Application Server running. And I am having a hard to have my GF successfully ping the database. Here is my GF set up

Assume: x.y.z.t is the ip of my VPS

Resource Type: javax.sql.ConnectionPoolDataSource
User: root
DatabaseName: scholar
Url: jdbc:mysql://x.y.z.t:3306/scholar
URL: jdbc:mysql://x.y.z.t:3306/scholar
Password: xxxx
PortNumber: 3306
ServerName: x.y.z.t

Inside my glassfish3/glassfish/lib, I have my mysql-connector-java-5.1.13-bin.jar

Inside the database, table mysql here is the result of the query

select User, Host from user;
+------------------+-----------+
| User             | Host      |
+------------------+-----------+
| root             | 127.0.0.1 | 
| debian-sys-maint | localhost | 
| root             | localhost | 
| root             | yunaeyes  | 
+------------------+-----------+

Now from my machine, if I try to connect to this db via mysql browser (mysql client software), well I cant. Well from the table above, seem like it only allow localhost to connect to this db. Keep in mind that both my db and my GF are on the same VPS. Please help

Answer

Your database is binding on 127.0.0.1. just change, in my.cnf, bind-interface to: x.y.z.t and it will work.

Attribution
Source : Link , Question Author : Harry Pham , Answer Author : Sacx

Leave a Comment