[google-appengine] Cannot connect to CloudSql from GAE PHP app

2013-11-25 Thread James Bond
Lets say my GAE app has: 

app id: foo123
name: myAppName
cloud sql instance id: foo123:mybucket


Im using PDO to connect: 
try{
 
   $pdo = new 
pdo(mysql:unix_socket=/cloudsql/*myAppName*:*foo123:mybucket*;charset=utf8, 
, );
   
}catch(PDOException $ex){
die(json_encode(
array('outcome' = false, 'message' = 'Unable to connect')
)
);
}



1. What is the password and the username? root@root doesnt work. I have 
also tried to set a root password in the cloud sql access control settings 
with no success.
2. Is my connection correct? I have tried many options with no success.



Quoted from the documentation: 

 In these examples, an App Engine app that belongs to a Google Cloud 
 Platform project called hello-php is connecting to a Cloud SQL instance 
 named my-cloudsql-instance. These examples show how to connect to Cloud 
 SQL in this scenario using PDO http://php.net/manual/en/book.pdo.php, 
 mysql_connect http://php.net/manual/en/function.mysql-connect.php, and 
 mysqli http://php.net/manual/en/book.mysqli.php.
 PDO
 $db = new PDO(
 'mysql:unix_socket=/cloudsql/hello-php:my-cloudsql-instance;charset=utf8',
   'username',
   'password'
 );

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [google-appengine] Cannot connect to CloudSql from GAE PHP app

2013-11-25 Thread Vinny P
On Tue, Nov 19, 2013 at 2:28 PM, James alex.aa...@gmail.com wrote:

 1. What is the password and the username? root@root doesnt work. I have
 also tried to set a root password in the cloud sql access control settings
 with no success.
 2. Is my connection correct? I have tried many options with no success.



Did you authorize your GAE application to access the Cloud SQL instance?
When you created the Cloud SQL instance, you should see the following
prompt: http://imgur.com/hdtKcLx . In this example picture, I've authorized
an application called learn.


-
-Vinny P
Technology  Media Advisor
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.