Connect with remote MySQL Database from Herokou - heroku

I am installing WordPress on Herokou app, I want to use external MySQL database that is hosted on Google SQL Cloud. I need a static IP or IP pool to enable on Goolges side firewall I can't figure out how to do so? or if this is a valid option using Herokou
Love to hear your thoughts

Using the Google Developer Console, select your Cloud SQL instance, go to 'ACCESS CONTROL' tab and add your application static IP Address/IP pool to the 'Authorize Networks' section. This will enable access to Cloud SQL instance from those IP addresses.

Related

Connect to Google Cloud SQL

When setting up the Google Cloud SQL, I have to set up the allowed network so that it can access to the cloud sql instance.
I want to make my application in cloud9 to connect to the cloud sql instance, is it possible to do that? How I can get the outgoing IP address to setup?
is cloud9 an appengine app?
if yes check this article:
Configuring Instance Access
https://cloud.google.com/sql/docs/access-control#appengine
Basically you can grant individual Google App Engine applications access to a Google Cloud SQL instance.

Creating an android studio project to run queries on a google cloud sql server using jdbc driver

I have an cloud sql instance up and running and have made a link using a jdbc driver to the instance ip using android studio project. I can successfully run queries from an ip address that I insert manually into the google cloud sql settings and not any other network. This makes my app accessible only from certain ip addresses. Is there a way i can authenticate my google cloud sql to all ip addresses. I do not wish to use the google app engine if possible as I believe it will only complicate my application. My app works well enough is there an easy way to access my sql from any network having supplied my username and password in the code itself?
You can use the console to authorize 0.0.0.0, which will allow connections from any IP address. However, this is not necessarily a good solution. If you embed your database's username and password in your Android app, it can be found by someone else taking apart the apk. If they do that, they will then have complete access to your database. It is more complicated, but you should put some kind of server in front of your database, and have the user authenticate with that server/application, and only have that server communicate directly with your database.

Cannot connect to AWS EC2 from visual studio (or anywhere actually)

I have an AWS server (MS SQL SERVER EXPRESS 2008 R2 with IIS), with an elastic IP of 54.214.8.111, security groups configured with HTTP, MS SQL and FTP, and I can connect to the remote virtual machine using the rdp file that amazon gives you in the console.
However when I try to connect via visual studio to test if the database is working, it gives me a "Login failed for user 'dbuser' error. I have a user called dbuser on my SQL Server (on the server side of course) with full access permissions etc. I also cannot connect to an ftp on the server, despite all guides and help doc. Something seems to be simply blocking my connection. I have tried the same thing on multiple computers.
Everything seems to be configured correctly except I suspect the server instance.
Can anyone help? PS I'm fairly new to web development, this is my first AWS EC2 server.
[UPDATE] I just tried to create a new instance in a different location, same error, maybe I don't know how to configure the SQL Server on the EC2?
I recently had the same connectivity issue to AWS/SQL Server, I finally have it resolved.
Connecting to SQL Server remotely on AWS involves 3 main factors:
AWS --> Windows Security --> SQL Server Settings/Security.
Connections can easily fail because each area has specific requirements. I'll go through the check-list:
AWS:
In AWS management console, go to Security Groups, click on the group that applies to your windows server, make sure MS SQL TCP port 1433 is open to your specific client IP. If not, you'll need to add it.
*UPDATE 5/10/22: In the inbound-security in AWS, if you enter 0.0.0.0 for source IP it will open that port publicly, you should not open the port to everyone. Only open this port to specific IP addresses and take additional security measures to protect it, allowing only authenticated users to access. Read up on security and how to configure to protect your SQL server.
Note the Public IP of your server
WINDOWS:
RDP to the Amazon Windows server, Start > Administrative Tools > Local Security Policy
Click Windows Firewall with Advanced Security, Windows Firewall Properties, Click the "Public Profile" tab, set Firewall State to "ON", Inbound to Block, Outbound to Allow (or block depending on your application). OK.
Expand the Windows Firewall (on the left Pane), R-Click the Inbound Rule, Click New Rule.
Click Port option, Next > , for TCP, enter 1433 Next >, Allow the connection, Next >, Next > , give it a name (SQL-PORT-ACCESS)
SQL-SERVER:
Login to SQL Server with SSMS (SQL Server Management Studio) using the default windows authentication.
On the left-pane, R-click the top server listing (with the database icon, the very first listing), and select "Properties"
Properties window, click Security on the left pane, choose the "SQL Server and Windows Auth"
Click Connections, check the "Allow Remote Connections" option ... Click OK.
Open the SQL Configuration Manager, Start > Programs > Microsoft SQL Server > Configuration Tools > SQL Server Configuration Manager
SQL Server Network Configuration (Expand), select Protocols for MSSQL, R-Click TCP , select Properties (TCP should be enabled)
Click IP Addresses tab, check that IP1 is enabled, Dynamic Ports is 0, TCP port is 1433
Scroll all the way down to IPAll section, Enter 0 in TCP Dynamic Ports, and 1433 in TCP Port. OK...
Back on the left pane, click, SQL Server Services, R-Click the SQL Server option, and select "Restart".
(NOTE: SQL Browser server does not impact connectivity, browser service only lists available servers, with your specific connection parms, no need to start or worry about the browser)
TESTING:
You don't have go to your remote client to test, start by trying to connect from the same SSMS window on the server. This reduces all the other things that can go wrong at first, if you can connect here, you have some confirmation that it works. If it doesn't work from your own server, the issues are related to Windows security and SQL security and setup.
Under the Object Explorer (SQL server Management Studio), click "Connect" > Database Engine...
In the Server name:, enter your PUBLIC IP, a comma, then 1433. Example, if your public IP is 54.4.4.4 , enter 54.4.4.4,1433,
Select the authentication as "SQL Server", enter the login user and password.
If you're using "sa", remember to change the password.
If your connection works locally, then you can try your remote client connection.
At this point you know your SQL server and user settings are correct.
Next, try using SSMS on another computer. If that fails, probably the firewall needs a 2nd look...
Good place to understand issues, is the SQL logs easily accessible from SSMS, on the left pane, expand Management, then SQL Server Logs, current log will list any problems.
So, those are all the parts involved -- miss one and you'll be frustrated, but start by reducing the pieces when testing.
I was able to connect to my database on AWS Windows Server/SQL Express from a Windows device...
Good Luck!

web service calling from console app, web service unable to connect the azure database

we want to connect the Azure database by using console application. my application sheduled in system it has dynamic IP. so i have problem to connect Sql Azure.
then developed a webservice and hosted in windows azure and consumed the web service from console still we have same issue.
please suggest
If you know the IP range, you can allow the entire range on the database firewall. It's not very elegant but will work.

Can't login to SQL Azure Management

Actually i have following step by step from http://www.windowsazure.com/en-us/manage/services/sql-databases/getting-started-w-sql-databases/ to create database and etc.
But when i try to login using username and password which i have configured,message error appear " Failed to retrieve connection information. Try to login again. "
I have configure firewall before to allowed my public ip to access the database.
How to solve my problem ?
Thanks
Clear your cookies and browsing history and contact Microsoft support if this persists after some time (like an hour)
That is very interesting problem.
What about checking connection with Microsoft SQL Server (can be Express edition).
If you configured firewalls then you should be able to access Azure database via Microsoft SQL Server Management Studio from your system with no problems.
Alternatively you could check Visual Studio. But I am not sure if Visual Studio Express edition can connect to Azure databases (you might need some paid version).
If you still have some connectivity issue using SQL Management Studio then that would indicate some networking problems between your place and Azure data centre. In that case I would recommend spinning up another Azure database (for very short time) in different data centre, set up firewalls and see if that will work.
EDIT
Any way to configure Firewall for Azure ?
Firewall to database cannot be configured at a level of individual databases; it needs to be configured at a level of server.
In Windows Azure Management portal, go to Database tab and then select database server:
Once you in server dashboard, select configuration top tab. You can change DB Server firewall allowed IP addresses under Allowed IP Addresses
In the same section there is Current Client IP Address which tell you the current IP. That very handy when you work with VPN or change your network quite often.
Allow popups. Chrome was blocking this from me.

Resources