Android client interaction with Java Server Data (i) SAE Server Setup

Source: Internet
Author: User

The test server is usually run on its own PC, using Tomcat or IIS to build a native server. In fact, Sina Cloud platform Sinaappengine is also very useful. Today I'll summarize some of the precautions I've used in the process:

1. Create the SAE application:

Login http://sae.sina.com.cn/ to register, Weibo account can be directly logged in. After successful registration, go to " my Home ", console > app Management > Create new app


Then enter the two-level domain name (the app's unique logo), apply the name and other information, and finally select the development language, here in Java as an example:


JVM Level Select " Economic edition ", the number ofJVM Select 1, do not tick dynamic scaling, and finally click " Create App ".

Once the app is created, you can see it in app Management, click the app title, and go to management:


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


How to export a War package:

Right-click the project in Eclipse ,export>war file .




2. Database operations:

Use the visualizer to manipulate the MySQL database:

In the left sidebar of the application home page, find " service Management ", click "MySQL", first initialize MySQL:


Then click " Manage MySQL" to enter the visual interface, or you can create a table using the SQL language:


The database of the SAE is mainly from the database and is written and read separately.

The display page is used from the database, the Insert page uses the primary database, and the URL has a small difference when connecting:

Main:

Write data using the main library Stringusername=saeuserinfo.getaccesskey (); Stringpassword=saeuserinfo.getsecretkey (); Stringdriver= "Com.mysql.jdbc.Driver"; Class.forName (Driver). newinstance (); Stringurl= "Jdbc:mysql://w.rdc.sae.sina.com.cn:3307/app_bleserver"; Connectioncon=drivermanager.getconnection (Url,username,password);

From:

Using read data from the library stringurl= "Jdbc:mysql://r.rdc.sae.sina.com.cn:3307/app_bleserver"; Stringsql = "SELECT * from message by id DESC"; Stringusername=saeuserinfo.getaccesskey (); Stringpassword=saeuserinfo.getsecretkey (); Stringdriver= "Com.mysql.jdbc.Driver"; Class.forName (Driver). newinstance (); Connectioncon=drivermanager.getconnection (Url,username,password);


Reprint Please specify source: Zhou Mushi's csdn blog Http://blog.csdn.net/zhoumushui

My github: Zhou Mushi's GitHub Https://github.com/zhoumushui


Android client interaction with Java Server Data (i) SAE Server Setup

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.