Krish
Krish

Reputation: 421

Error while trying to connect to an external DB server from Google App Engine

I have a scenario where for a certain reason I cannot use Google's Cloud SQL. Hence I want the application at appid.appspot.com to connect to an external DB server.

DB.php

'hostname' => '202.202.202.202',
    'username' => 'user',
    'password' => 'password',
    'database' => 'dbname',
    'dbdriver' => 'mysql',

This gives me a Server Error, however I'm able to connect to the database from mysql workbench. This application does not have a problem while connecting to Cloud SQL.

Error message:

Error: Server Error

The server encountered an error and could not complete your request.
Please try again in 30 seconds.

Can someone help me understand where I'm going wrong.

Upvotes: 0

Views: 261

Answers (1)

Krish
Krish

Reputation: 421

I did the following changes and got it working.

Instead of IP address I gave the external DB server a hostname.

'hostname' => 'dbserver.example.com',
'username' => 'user',
'password' => 'password',
'database' => 'dbname',
'dbdriver' => 'mysqli',

Then I activated billing for the Google App Engine project. Once you activate billing the Google Socket API will start functioning.

Please do not try immediately. Give it sometime and this should start working just fine.

Upvotes: 1

Related Questions