Access mysql data base remotely from playframework 1.2.4 - mysql

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.

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

Problems connecting Laravel to a remote MySQL database: "Lost connection to MySQL server at handshake" and "MySQL server has gone away"

I got this problem where I have developed a Laravel application which uses or connects to a external database.
I have copied all Laravel files in a CentOS server that needs to connect to a MySQL database that is located in another (Ubuntu) server.
Locally, I didn't have any trouble with Laravel Homestead.
But now the Laravel app throws the following error:
SQLSTATE[HY000] [2006] MySQL server has gone away
And if I try to connect to the external database from the CentOS terminal,
$ mysql -h xxx.xxx.xxx.xxx -P 3306 -u user4laravel -p
I get this other error:
ERROR 2013 (HY000): Lost connection to MySQL server at 'handshake:
reading inital communication packet', system error: 11
Notes: I connect to that server via SSH Tunnel with SSH-KEY and passphrase. Do I have to create a tunnel connection?
How do I make it persistent? Is this practical? Or ...
Does anybody know how to solve this or a workaround?

Openshift mysql connection error channel timeout

I have an Tomcat 7 application on openshift and I have added a MySQL cartridge. I have a problem connecting to that database using MySQL workbench.
I have added all the necessary parameters like hostname, username, password and SSH key, I have tested the connection and I get no errors. But when I try to connect to the db I get the following error:
Your connection attempt failed for user 'adminxxxx' from your host to server xx.xxx.xxx.xxx:3306:
Tunnel error: Remote connection to xx.xxx.xxx.xxx:3306 failed: IOError('open SSH tunnel timeout',)
What can I do to fix this? Connecting to the db is a big part of the application.

GlassFish can't connect to mysql (XAMPP)

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.

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).