what the best way to connect my endpoints to SQL 2gen

70 views
Skip to first unread message

Guy Dviri

unread,
Mar 23, 2018, 12:29:44 PM3/23/18
to Google App Engine
I using java on android studio ,also I used JDBC DriverManager on the server side to connect to the cloud SQL, 
I read somewhere that I don't need to use DriveManager in the server side anymore when upgrading to 2gen , and the connection should be from the app , 
does any one have any code sample or can simplify the process of connecting my endpoints to 2gen using java?

Katayoon (Cloud Platform Support)

unread,
Mar 26, 2018, 8:53:46 PM3/26/18
to Google App Engine

Hi Guy, Here, you can find a section in the left-hand navigation menu named, "Connecting to Instances" which gives you the various ways on how to connect to instances. You can read about Cloud Endpoints in the documentation as well. It's basically a means of writing code which will run and react to a request whenever an API request comes to the back-end server you'll deploy on Google's infrastructure.


You need to send a request to your API handler code, which will then open a connection with the Cloud SQL to perform any actions necessary. These API requests are generally going to be initiated by using a client library, either in JS for the browser, or in Java for Android, etc.Below you can find the sequence:


Client code -> Endpoints code -> Cloud SQL instance


Guy Dviri

unread,
Mar 27, 2018, 2:50:34 AM3/27/18
to Google App Engine
Thanks Katayoon , I hope you can clear something to me.
      Client code ->   Endpoints code -> { Cloud SQL Instance ,does the  ( user ,pass ) need to hold in the client code attach somehow with the webAPI  or they store in the server side? )


what confuses me is the appengine-web.xml and the poem.xml both seems to hold duplicate values of my SQL ( user & pass ). 
in the first gen SQL i hold the ( pass,user ) in the DriverManager on the server side , so I puzzled what the DriverManager role in the 2gen SQL implement scenario, and where I need to input the SQL ( user ,pass) values?.

Katayoon (Cloud Platform Support)

unread,
Mar 27, 2018, 7:36:46 PM3/27/18
to google-a...@googlegroups.com

Pom.xml is to specify the dependencies and the required credentials to get connected to your Cloud SQL instance, and appengine-web.xml is applied in the App Engine side to specify the app's configuration (in App Engine side) in case you want to have an App Engine application. The link you have provided shows the steps on how to get connected to the SQL instance  from App Engine standard. Using the Cloud Endpoints, you expose your code/SQL instance to whoever you would like to get accesses to the endpoints and you can simply send your request to the SQL instance through endpoints.


I see that you have created a duplicate thread about this question. In order to avoid duplicating efforts I will let you work with that.


Guy Dviri

unread,
Mar 28, 2018, 6:59:13 AM3/28/18
to Google App Engine
Thanks Katayoon so I don't need the configuration in the appengine-web.xml and the web.xml because all my connection with the SQL is in the server side.

now one more thing , I like to now if my connection to SQL is open or close via the Cloud Console is there's a way to check it out?

Katayoon (Cloud Platform Support)

unread,
Mar 28, 2018, 8:35:46 PM3/28/18
to Google App Engine

If you don’t have an App engine app and servlet, you won’t need appengine-web.xml and web.xml.


You can check the available metrics of your Cloud SQL instance including “active connections” through the Info panel/Monitoring tab.


Kindly note, that Google Groups are reserved for general product discussions and are not for technical support. For further technical support it is recommended to post your redacted questions to Stack Overflow using the supported Cloud tags.


PS. I corrected the link of the duplicate thread in my previous comment.


Reply all
Reply to author
Forward
0 new messages