I am trying to access my MYSQL database from my EC2 instance using PHP and it keeps coming up with the error in the browser (below). I can access my MYSQL database on the RDS instance when i access my EC2 from the console. Please can someone advise?
define('DB_USER', "myUserName"); // db user
define('DB_PASSWORD', "myPassword"); // db password (mention your db password here)
define('DB_DATABASE', "myDatabaseName"); // database name
define('DB_SERVER', "myEndPoint");
// Connect to database
$mysqli = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_DATABASE);
if($mysqli->connect_errno) {
echo 'connection to RDS error';
}else{
echo 'connection to RDS success!'
}
Broswer readout:
This page isn’t working
ip.ip.ip.ip is currently unable to handle this request.
HTTP ERROR 500
Related
I am trying to connect to an Oracle DB and query a stored procedure in that DB, but I fail to make a connection to the DB. Here is the connection string:
"ConnectionString": "data source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=somehost)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=somename)));user id=someuserid;proxy user id=somepuserid;password=somepass;Persist Security Info=true"
But I get this error when I try to open the connection:
ORA-01005: null password given; logon denied
Probably you specified proxy user id, but didn't specify Proxy Password.
Try this (no proxy User ID)
"ConnectionString": "Data Source=//somehost:1521/somename;User ID=someuserid;Password=somepass;"
I am unable to create connection with oracle rds by aws. My database is public and also open all inbound traffic for oracle instance in aws.
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=database.xxx.ap-south-1.rds.amazonaws.com)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)))
The above string working but when i am creating and inserting the table data it shows success but when using select query it gives 0 results.
What i m doing wrong here ?
It's a follow up question that I asked earlier here on Stack Overflow
Not able connect Amazon Aurora Serverless from SQL client
I found a cool hack that is working perfectly for my development purpose with some tweaks and I know I should not use this on my production environment.
So as we know Aurora Serverless works only inside VPC. So make sure you are attempting to connect to Aurora within the VPC and the security group assigned to the Aurora cluster has the appropriate rules to allow access. As I mention earlier that I already have an EC2 instance, Aurora Serverless and a VPC around both. So I can access it from my EC2 but not from my local pc/ local sql client. To fix that I did below two steps.
1. To access from any client(Navicat in my case),
a. First need to add GENERAL db configurations like aurora endpoint host, username, password etc.
b. Then, need to add SSH configuration, like EC2 machine username, hostip and .pem file path
2. To access from project,
First I create a ssh tunnel from my terminal like this way,
ssh ubuntu#my_ec2_ip_goes_here -i rnd-vrs.pem -L 5555:database-1.my_aurora_cluster_url_goes_here.us-west-2.rds.amazonaws.com:5432
Then run my project with db configuration like this way test.php,
$conn = pg_connect("host=127.0.0.1 port=5555 dbname=postgres user=postgres password=password_goes_here");
// other code goes here to get data from your database
if (!$conn) {
echo "An error occurred.\n";
exit;
}
$result = pg_query($conn, "SELECT * FROM brands");
if (!$result) {
echo "An error occurred.\n";
exit;
}
while ($row = pg_fetch_row($result)) {
echo "Brand Id: $row[0] Brand Name: $row[1]";
echo "<br />\n";
}
So what is my question now?
I need to connect my aurora serverless from tableau desktop and tableau server. For tableau desktop I used the same ssh tunneling and it works but how do I do it for tableau server?
Tableau Server does not support centralized data sources. You need to connect Tableau Desktop to your data source, and publish it to Tableau Server when you want to expose the data through the UI.
https://community.tableau.com/thread/111282
I am using AWS RDS Server for our database. It is working fine but some time it shown an error:
exception 'PDOException' with message 'SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'HOSTNAME'
And when i am hitting my page two-three time it will gone.
Anyone suggest me, what is the issue while we are using AWS RDS with EC2 instance.
I have created my RDS (sqlserver instance) and it is working fine when i connect from sqlserver express. Now i want to connect to Redshift cluster via the client. Both cluster are under VPC and i have already set up the security group for both.
I have created the linkedserver in my sqlserver express as follows.
EXEC sp_addlinkedserver
#server=N'Staging64', -- Linked Server Display Name
#srvproduct=N'test', -- Default to SQL Server
#provider=N'SQLNCLI', -- Use SQLNCLI
#datasrc=N'52.167.514.101', -- FQDN of remote server running redshift
#catalog = 'test';
EXEC sp_addlinkedsrvlogin #rmtsrvname = 'Staging64' -- Linked Server Display Name
, #useself = 'false' -- Do not masquerade
-- , #locallogin = '' -- Commented out to force all local users to use linked login
, #rmtuser = 'dev' -- Remote user name
, #rmtpassword = 'dev2015'; -- Remote password
The linked server is created without any issues but when i execute this query:
SELECT TOP 10 * FROM Staging64.test.stage.dw_viasatsubscription;
it throws this error message:
OLE DB provider "SQLNCLI11" for linked server "Staging64" returned message "Login timeout expired".
OLE DB provider "SQLNCLI11" for linked server "Staging64" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.".
Msg 53, Level 16, State 1, Line 25
Named Pipes Provider: Could not open a connection to SQL Server [53].
I have tried to google a lot but it has been in vain.
Any feedback will be appreciated.
Amazon Redshift can export data to Amazon S3 with the UNLOAD command:
Unloading Data to Amazon S3
UNLOAD command
This data can then be imported into SQL Server, as with any CSV data.
There are some systems can assist with this process (eg Amazon Elastic MapReduce, Amazon Data Pipeline), but they are probably overkill for your situation.