Interaction data between Android client and Java Server (I) Construction of SAE server, androidsae

Source: Internet
Author: User

Interaction data between Android client and Java Server (I) Construction of SAE server, androidsae

Usually, the testing server runs on your own PC and is a local server built using Tomcat or IIS. In fact, Sina cloud platform SinaAppEngine is also quite useful. Today I want to summarize some of my usage considerations:

1. Create an SAE application:

Log on to http://sae.sina.com.cn/to register your account. After successful registration, go to "my homepage", Console> Application Management> Create New Application


Enter the second-level domain name (unique application ID), Application name, and other information, and select the development language. Here, Java is used as an example:


Select "Economic edition" for JVM level, 1 for JVM quantity, Dynamic Scaling not selected, and then click "create application ".

After the application is created, you can see it in "Application Management". Click the application title to go to management:


Next, create a version, enter the version number, and upload the code. Java needs to upload the War package:


War package export method:

In Eclipse, right-click the project and choose Export> WAR file.




2. database operations:

Use a visual tool to operate a MySQL database:

Find "Service Management" on the Left bar of the application homepage, click "MySQL", and initialize MySQL first:


Click "manage MySQL" to enter the visual interface. You can also create a table using the SQL language:


SAE databases are divided into master and slave databases for writing and reading respectively.

The display page uses the slave database and the insert page uses the master database. There is a small difference in the URL during connection:

MASTER:

// Use the master database to write data Stringusername = SaeUserInfo. getAccessKey (); Stringpassword = SaeUserInfo. getSecretKey (); Stringdriver = "com. mysql. jdbc. driver "; Class. forName (driver ). newInstance (); Stringurl = "jdbc: mysql: // export rdc.sae.sina.com.cn: 3307/app_bleserver"; Connectioncon = DriverManager. getConnection (url, username, password );

From:

// Use the StringURL = "jdbc: mysql: // r.rdc.sae.sina.com.cn: 3307/app_bleserver"; Stringsql = "select * from message orderby id desc"; StringUsername = SaeUserInfo. getAccessKey (); StringPassword = SaeUserInfo. getSecretKey (); StringDriver = "com. mysql. jdbc. driver "; Class. forName (Driver ). newInstance (); Connectioncon = DriverManager. getConnection (URL, Username, Password );


Reprinted please indicate the source: Zhou mu Shui CSDN blog http://blog.csdn.net/zhoumushui

My GitHub: Zhou mu Shui's GitHub https://github.com/zhoumushui


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.