GlassFish can't connect to mysql (XAMPP) - mysql

I'm trying to connect my glassfish with a mysql server (installed via XAMPP) and it says:
Ping Connection Pool failed for jdbc/xxxx. Connection could not be allocated because: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. Please check the server.log for more details.
My configs in glassfish are:
URL: jdbc:mysql://localhost:3306/SIRS
User: root
Password: xxxxxxx
Both servers are in the same pc running ubuntu.
I have the same configurations working properly in another pc but without XAMPP installation, I've installed mysql server with apt-get install mysql... command.
Any ideas why is this happening?
Thanks.
JB

One possibility is that mysql server & glassfish server are installed on the same host.
So, you should go to etc/mysql/my.cnf if there is a public ip address bind you should remove it and put only bind-address = 127.0.0.1
Another case is that in stead of URL: jdbc:mysql://localhost:3306/SIRS you should put
URL: jdbc:mysql://127.0.0.1:3306/SIRS
This worked for me.

Related

Apache NiFi on Windows machine failed to connect to MySQL database on same host

I have an instance of Apache NiFi running on the windows machine. I have failed to connect it with the MySQL database which is running on localhost and is accessible from any host.
I have attached the configurations of the connection
I tried to change the class name from com.mysql.jdbc.Driver to com.mysql.cj.jdbc.Driver and vice-versa without success, I also tried to change the Database connection URL port from 3306 t0 33061 and vice-versa also without any success.
on the bulletin board am getting the error "No suitable driver for the given Database Connection URL: No suitable driver for the given Database Connection URL and the status is stuck on enabling even after restarting the apache NiFi.
Please assist am stuck in here.
ps: I don't have password set for the root user of my database
typo in url - you have jbds instead of jdbc

problem in connecting zabbix to remote DB

I installed zabbix 4.0 in centOs 7 and configured it to connect to remote mysql.
But log file says that it can not connect to DB.
I tried to telnet to DB machine and I was OK!
telnet 10.1.13.33 3306
Trying 10.1.13.33...
Connected to 10.1.13.33.
here is my /etc/zabbix/zabbix_server.conf:
SourceIP=10.1.9.140
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
DebugLevel=5
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBHost=10.1.13.33
DBName=zabbix
DBUser=zabbix
DBPassword=******************
DBPort=3306
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
When starting zabbix, in /var/log/zabbix/zabbix_server.log there is a line like this:
[Z3001] connection to database 'zabbix' failed: [2003] Can't connect to MySQL server on '10.1.13.33' (13)
database is down: reconnecting in 10 seconds
By default, Zabbix server does not understand which IP to be listened. So you have to also mention your ListenIP in /etc/zabbix/zabbix_server.conf:
ListenIP=<your_ip>

Navicat Essentials (11); Can't connect to mysql server

I have just updated to Navicat Essentials 11 on Mac. I'm using Zend server and now the old settings don't work:
General tab:
Host name: localhost
Port: 3036 (tried also with 3306)
And under advanced tab:
Use socket file: /usr/local/zend/mysql/tmp/mysql.sock
I get an error:
Can't connect to local MySQL server through socket '/usr/local/zend/mysql/tmp/mysql.sock' (1)
I copied mysql.sock file to /tmp and tried with with default socket settings:
Use socket file: /tmp/mysql.sock
I also got an error
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Facts
can't connect with Navicat Essentials 11
mysql server is running
username and password are correct
socket file worked in previous version
Thank you for your help.
I'ma answering my own question:
I made a http tunnel file (Navicat -> Connection Properties -> Save Tunnel script as...) and copied in on the root of local server. Now I'm connectig via http tunnel:
http://localhost/ntunnel_mysql.php
and everything seems to work fine.
I had an error "protocol mismatch" when trying to connect at first time. Full restart of computer solved this problem too (?).

Access mysql data base remotely from playframework 1.2.4

I want to access sql database remotely from play framework version 1.2.4
I am running play in virtualbox and I have mysql database in local pc.
app/conf/application.conf
db.url=jdbc:mysql://xxx.xxx.47.78:3306/vedb
db.driver=org.postgresql.Driver
db.user=root
db.pass=aaa123aaa
/etc/mysql/my.cnf
bind-address=xxx.xxx.47.78
when I start the app with http://localhost:9000/ I am getting below error
A database error occured : Cannot connected to the database,
Communications link failure The last packet sent successfully to the
server was 0 milliseconds ago. The driver has not received any packets
from the server.
In your example you define a mysql URL but set the driver to postgresql...
Try to comment the driver setting, or set it to: 'com.mysql.jdbc.Driver'
You can alos try to connect to your mysql server using the mysql command line:
mysql -h xxx.xxx.47.78 -u root -p
Then enter the root password (mysql root password). This will test the network connection to the mysql server.

play framework - connect to linux mysql

I am new play framework. I am trying to connect to mysql database on linux server. it is not working !!
I am getting an error:
A database error occured : Cannot connected to the database, Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
anyway I am able to connect linux server through my MySQL Work bench.
application.mode=dev
%prod.application.mode=prod
jpa.ddl=update
db.url=jdbc:mysql://<ipaddress>:3306/<database>?useUnicode=false&characterEncoding=ISO-8859-1&connectionCollation=utf8_swedish_ci
db.driver=com.mysql.jdbc.Driver
db.user=<user>
db.pass=<password>
ensure that you have the correct ip address and port nunmber for mysql in the config file (as well as the correct username/pwd).
you can check if mysql is listening on the port (try netstat -an | grep 3306).