How to add oracle's x-devapi to node js server

2019-06-03 06:53发布

问题:

I have been coding my app with x-devapi locally on my computer and for the last 5 hours, I have tried possible workorounds to host it on Google app-engine but unsuccessful. I am only able to connect to Google App engine's MySQL database as illustrated in their documentation. However I want to use the X-devApi. Does Google app-engine support Oracle's X-devApi? how can I achieve this?

UPDATE:

According to the X-devApi documentation, the database connection happens when the X-devAPI is enabled in the database. This is how I enable it locally :

sudo mysqlsh -u root -h 127.0.0.1 --mysql --dba enableXProtocol

Secondly, the language have to be specified with command e.g \py for python, for example. I use Nodejs for my server and I have researched alot on how to enable the X-devApi on the console but I have not found any documentations.

Here is How I connect locally,

var mysqlx = require('mysqlx');
 
// Connect to server on localhost
var mySession = mysqlx.getSession(“mysqlx://user:password@localhost:33060”)
 
var myDb = mySession.getSchema('test');

While google cloud has three procedures:

  1. Creating Instance and setting password:- gcloud sql users set-password root % --instance [INSTANCE_NAME] --password [PASSWORD]

    1. Setting up the Cloud SQL instance and creating database respectively:- gcloud sql users create [USER_NAME] [HOST] --instance=[INSTANCE_NAME] --password=[PASSWORD] , gcloud sql databases create [DATABASE_NAME] --instance=[INSTANCE_NAME]

Point of difficulty: How, and at which point do I enable the X-devApi, is it at instance or user level? if possible, please help with this procedure.

回答1:

So far I've been investigating the Google Cloud SQL instances are not compatible with X protocol, which is completely necessary for X-devAPI.

Therefore, currently there is no way to use said tool with Cloud SQL.

There is an ongoing feature request in the public issue tracker of Google. If it is very important for you, please consider marking it as favorite so you can receive notifications of their updates, and it will give the feature request better priority.