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