Can't Connect to External MYSQL database from Heroku - mysql

My Ruby app connects to 2 databases in production: a PG database on the heroku server(successful) and a remote mysql database (unsuccessful).
The database URLs are stored in environment variables (in application.yml locally, and in config vars on Heroku).
The app is successfully retrieving data from both of these databases in development mode, so I know the URLs and credentials are valid.
On Heroku, only the pg connection is successful;
the MySQL connection throws a generic error: Mysql2::Error (Can't connect to MySQL server on 'villageprint.mypresswise.com' (110)):.
So both URLs are definitely being read from the config vars but the MYSQL connection is still unsuccessful.
Is there any reason the MySQL database might not accept the connection from Heroku? Or is it more likely that the connection is failing due to some application error? How can I debug this?

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

Linkedin WhereHows - Docker Backend not able to connect to MySQL

When I try to connect WhereHows backend to MySQL DB in Docker environment I am getting following error message (I checked IP, Username and Password and all 3 are good):
1) Error in custom provider, Configuration error: Configuration error[Cannot connect to database [wherehows]]
At the same time, WhereHows web is connecting without any problem.
Docker version is 17.12.0-ce and I am using following images:
wherehows/backend
wherehows/web
wherehows/mysql
This is my config file - /backend-service/conf/application.conf
# connection to wherehows mysql database
db.wherehows.driver = com.mysql.jdbc.Driver
db.wherehows.url="jdbc:mysql://localhost/wherehows?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false"
db.wherehows.username="wherehows"
db.wherehows.password="wherehows"

Migrating Data from Remote MySQL server to Rails App

This is a follow up question to "How to create a ssh tunnel in ruby and then connect to mysql server on the remote host" from 5 years ago.
I'm trying to create an SSH tunnel in Ruby and then connect to a remote MySQL database. I'm doing this because I need to move some legacy data from an older version of my app, so I don't need ActiveRecord, migrations, etc.
I'm using the NetSSHGateway gem and the MySQL2 gem.
Here's my Ruby code (run in rails console):
gateway = Net::SSH::Gateway.new('old_remote_server.com','server_username')
port = gateway.open('127.0.0.1', 3306, 3307)
client = Mysql2::Client.new(
host: "127.0.0.1",
username: 'database_username',
password: 'database_password',
database: 'database_name',
port: port
)
After the last line, the console hangs for about 2 minutes, and then gives me the error:
Mysql2::Error: Lost connection to MySQL server at 'reading initial communication packet', system error: 0
I am able to SSH into the remote server, and execute MySQL commands that way, so I'm not sure what the issue is here.
After some thought, this isn't likely the best way to migrate data, for a few reasons.
In the end, I simply dumped my legacy MySQL database, moved it to my new app's environment, and used the MySQL2 gem to build rake tasks to translate and move the data into my new app.

Migrate MS SQL Server database to MySQL using Workbench migration wizard over ssh

I am trying to migrate a SQL Server 2008 database to MySQL. The MySQL database is on a vps on digital ocean. In the migration process, the source selection was successfull but the target selection is not. For the target selection, I used the connection method as Standard TCP/IP over SSH. Clicking on Test connection gives the error "Unsupported connection method. MySQL connections over SSH are not supported in this version of MySQL workbench migration wizard."
I have MySQL version 6.1
These are the parameters I used:
SSH Hostname: host IP address:22
SSH Username: root
SSH Password: host password
SSH KeyFile: I did not set up a key file for my MySQL db. Is it required?
MySQL HostName: 127.0.0.1
MySQL Server port: 3306
username: root
password: password to MySQL
Please tell me if I am missing something or if I am giving the parameters wrong.
Do I have to set the ssh key file to migrate the database over ssh?
Note
The migration process does not support source or target RDBMS connections through SSH.
A workaround is to set up an encrypted tunnel, and then treat the MySQL target as a standard TCP (unencrypted) connection.
I found this note on the MySQL Workbech documentation for migration wizard. Heres the link
http://dev.mysql.com/doc/workbench/en/wb-migration-install.html
I do not know how to do the migration with the suggested work around. Any help will be greatly appreciated.
Thanks.
This is what I did:
First, Install MySQL on the same machine where the MS SQL Server database exists. Use the MySQL Migration wizard to migrate the database locally. Now there are two options here.
OPTION 1: Create a backup file for the migrated database in MySQL. Use this backup file and restore database in the target MySQL.
OPTION 2: Export each table from the migrated database in MySQL to .csv files and then copy these files to the server and import them in to the target MySQL database.

Can't connect to MySQL from webapp in Ubuntu

I have a MySQL database I'm able to connect via the command prompt and the MySQL administration tool but using the same credentials in a Web application in a Tomcat server on the same server gives me this error:
javax.servlet.ServletException: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Could not create connection to database server. Attempted reconnect 3 times. Giving up.)
Which I recognize as an incorrect credentials issue. I checked that the MySQL server is listening on port 3306 using netstat. I don't have the mysql root credentials but I created a new account and granted all priviledges to it and are the ones used to connect both using the command prompt and the MySQL admin tool.
Turned out to be a caching issue. Disabled the context caching in the web application in order to "see" the changes. Windows doesn't show this behavior/issue.