網站 :https://cloud.baidu.com/?from=consolejava
點擊添加新服務mysql
當咱們看到上面那張圖的時候就須要去修改代碼了sql
進入工具包數據庫
package util;app
import java.sql.Connection;
import java.sql.DriverManager;工具
public class ConnManager {
/*
//數據庫5大參數
private static final String IP = "127.0.0.1";
private static final String PORT = "3306";
private static final String DATABASE_NAME = "pyq";
private static final String USER_NAME = "root";
private static final String PASSWORD = "123456";
private static final String DRIVER = "org.gjt.mm.mysql.Driver";
*/
//百度雲
private static final String IP = "sqld.duapp.com";
private static final String PORT = "4050";
private static final String DATABASE_NAME = "nEgQAeNNqsNEiFYZAzKF";
private static final String USER_NAME = "80191ff9af3b4a2e8d320fd95587a716";
private static final String PASSWORD = "ec31abebf4ac48af86ba16f63346337f";
private static final String DRIVER = "org.gjt.mm.mysql.Driver";
public static Connection getConnection() throws Exception {
String url = "jdbc:mysql://"+IP+":"+PORT+"/"+DATABASE_NAME+"?user="+USER_NAME+"&password="+PASSWORD+"";
Class.forName(DRIVER);
Connection conn = DriverManager.getConnection(url);
//System.out.println("ConnManager已經建立了鏈接:"+conn);
return conn;
}post
}網站
咱們須要把之前的數據庫5大參數的IP,端口,數據庫名,帳號,密碼,url
改成百度雲基本信息哪裏的數據:spa
分別輸入下面這些SQL語句,而後執行
創建表
create table user(
id int primary key auto_increment,
account varchar(20),
password varchar(20),
nick varchar(40),
head_pic varchar(100)
);
insert into user(account,password,nick,head_pic)
values('001','123','花千骨','1.jpg');
insert into user(account,password,nick,head_pic)
values('002','123','白子畫','2.jpg');
insert into user(account,password,nick,head_pic)
values('002','123','殺阡陌','3.jpg');
create table saysay(
id int primary key auto_increment,
post_man int,
content varchar(200),
content_type int,
post_time datetime,
post_addr varchar(200),
post_device varchar(100),
click_time int
);
insert into saysay(post_man,content,content_type,post_time,post_addr,post_device,click_time)
values
(1,'白子畫很帥',1,'2017-06-26 15:05:01','珠海.北方','山寨機',0);
insert into saysay(post_man,content,content_type,post_time,post_addr,post_device,click_time)
values
(3,'想睡覺了',1,'2017-06-26 15:05:01','北京.中南海','老人機',0);
當咱們執行完上面的SQL語句之後,咱們的表和數據就已經插入成功 了
3、安裝SVN服務
下載SVN:直接百度SVN就能夠了
右鍵點擊SVN Checkout…(若是沒有安裝SVN右鍵是沒有的)
項目------>右鍵---------->Export------>WAR file
有感嘆號是由於咱們導出的項目尚未更新,和百度雲裏面的代碼不一致
咱們在進入百度雲服務裏面
看到這個說明就已經成功了