JavaWeb: deploy the SSH project on Sinaapp and bind the Domain Name

Source: Internet
Author: User
Tags in domain

JavaWeb: deploy the SSH project on Sinaapp and bind the Domain Name
1. Create a new application in SAE
When creating an application, we need to enter a second-level domain name, such as XXXXXX. In the "development language" column, select Java and then select the corresponding JVM level.

2. view application information

Figure 1 application information

Among them, we must note that the Access Key and Secret Key here are the user name and password when accessing MySQL.

3. Manage MySQL

Figure 2

After clicking in, we can manage MySQL, as shown in, mainly the address and port number of MYSQL and the name of the database. The database name is app_XXXXXX, where XXXXXX is the name of the app. Then, we can create a database table under the current database.

Figure 3

We can use SQL to create the corresponding database table. For example, the database table corresponding to this SSH project is:

 

/*Navicat MySQL Data TransferSource Server         : localhost_3306Source Server Version : 50027Source Host           : localhost:3306Source Database       : sshmysqlTarget Server Type    : MYSQLTarget Server Version : 50027File Encoding         : 65001Date: 2015-01-11 10:43:42*/SET FOREIGN_KEY_CHECKS=0;-- ------------------------------ Table structure for bbscomment-- ----------------------------DROP TABLE IF EXISTS `bbscomment`;CREATE TABLE `bbscomment` (  `uuid` varchar(36) NOT NULL,  `messageid` varchar(32) NOT NULL,  `username` varchar(32) NOT NULL,  `content` varchar(512) NOT NULL,  `touser` varchar(32) default NULL,  `agree` int(8) default NULL,  `disagree` int(8) default NULL,  `date` varchar(40) NOT NULL,  `top` int(8) default NULL,  `Reserve1` varchar(128) default NULL,  `Reserve2` varchar(128) default NULL,  PRIMARY KEY  (`uuid`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;-- ------------------------------ Table structure for bbsmessage-- ----------------------------DROP TABLE IF EXISTS `bbsmessage`;CREATE TABLE `bbsmessage` (  `uuid` varchar(36) NOT NULL,  `username` varchar(32) NOT NULL,  `content` varchar(512) NOT NULL,  `imageheadurl` varchar(256) default NULL,  `agree` int(8) default NULL,  `disagree` int(8) default NULL,  `share` int(8) default NULL,  `address` varchar(40) default NULL,  `date` varchar(40) NOT NULL,  `top` int(8) default NULL,  `phonemodel` varchar(32) default NULL,  `Reserve1` varchar(128) default NULL,  `Reserve2` varchar(128) default NULL,  PRIMARY KEY  (`uuid`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;-- ------------------------------ Table structure for student-- ----------------------------DROP TABLE IF EXISTS `student`;CREATE TABLE `student` (  `id` varchar(36) NOT NULL,  `name` varchar(32) NOT NULL,  `course` varchar(64) NOT NULL,  `score` int(11) NOT NULL,  `remarks` varchar(512) default NULL,  PRIMARY KEY  (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;-- ------------------------------ Table structure for userinfo-- ----------------------------DROP TABLE IF EXISTS `userinfo`;CREATE TABLE `userinfo` (  `uuid` varchar(36) NOT NULL,  `username` varchar(32) NOT NULL,  `password` varchar(16) NOT NULL,  `imageheadurl` varchar(256) default NULL,  `level` int(8) NOT NULL,  `registertime` varchar(40) NOT NULL,  `Reserve1` varchar(128) default NULL,  `Reserve2` varchar(128) default NULL,  PRIMARY KEY  (`uuid`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;

 

jdbc.mysql.url=jdbc:mysql://w.rdc.sae.sina.com.cn:3307/app_XXXXXXjdbc.mysql.username=Access Keyjdbc.mysql.password=Secret Key

 

<! -- Create a mysql jdbc data source --> <bean id = "c3p0dataSource" class = "com. mchange. v2.c3p0. comboPooledDataSource "destroy-method =" close "> <property name =" driverClass "value =" $ {jdbc. mysql. driver} "/> <property name =" jdbcUrl "value =" $ {jdbc. mysql. url} "/> <property name =" user "value =" $ {jdbc. mysql. username} "/> <property name =" password "value =" $ {jdbc. mysql. password} "/> <property name =" testConnectionOnCheckin "value =" true "/> <property name =" testConnectionOnCheckout "value =" true "/> </bean>

 

<bean id="sessionFactory"class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"><property name="dataSource" ref="c3p0dataSource" /><property name="hibernateProperties"><props>    <prop key="hibernate.autoReconnect">true</prop><prop key="hibernate.show_sql">false</prop><prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop><prop key="current_session_context_class">thread</prop></props></property>...</bean>

Figure 4

After a while (half a minute), we can access XXXXXX.sinaapp.com to check whether the deployed project can run successfully.

So far, this SSH project has been successfully deployed on sinaapp.

 

6. domain name binding

If the domain name on Sina is a second-level domain name, how can we bind the second-level domain name with the first-level domain name we purchased?

I usually buy a domain name on www.net.cn. After I buy a domain name, I need to register and authenticate my identity, and then I can resolve it.

First, click "bind" on the "Application Homepage" and "independent domain name" in SAE: Enter the domain name to be bound. The following dialog box is displayed:

Figure 5

Note that the circled content is used in domain name resolution.

Go to the hichina Resolution Page and add the correct CNAME information and A record information on the resolution page as prompted by SAE.

For example, the following is the resolution of a domain name of mine:

Domain name binding takes effect in about 1 minute.

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.