1.新建一个项目然后配置好Tomcat等。
2.创建三张空表
房产基本信息表
房产经纪人基本信息表
顾客基本信息表
3.java Bean封装类
package com.Bean;
public class bean
{
private String HouseID;
private String HouseType;
private String Address;
private String Year;
private String Area;
private String Sales;
private String Status;
private String AgentID;
private String UserID;
private String AgentName;
private String AgentAddress;
private String AgentPhone;
private String UserName;
private String Sex;
private String IdNumber;
private String UserPhone;
private String UserAddress;
private String Upassword;
private String Apassword;
private String Check;
public String getCheck()
{
return Check;
}
public void setCheck(String check)
{
Check = check;
}
public String getHouseID()
{
return HouseID;
}
public void setHouseID(String houseID)
{
HouseID = houseID;
}
public String getHouseType()
{
return HouseType;
}
public void setHouseType(String houseType)
{
HouseType = houseType;
}
public String getAddress()
{
return Address;
}
public void setAddress(String address)
{
Address = address;
}
public String getYear()
{
return Year;
}
public void setYear(String year)
{
Year = year;
}
public String getArea()
{
return Area;
}
public void setArea(String area)
{
Area = area;
}
public String getSales()
{
return Sales;
}
public void setSales(String sales)
{
Sales = sales;
}
public String getStatus()
{
return Status;
}
public void setStatus(String status)
{
Status = status;
}
public String getAgentID()
{
return AgentID;
}
public void setAgentID(String agentID)
{
AgentID = agentID;
}
public String getUserID()
{
return UserID;
}
public void setUserID(String userID)
{
UserID = userID;
}
public String getAgentName()
{
return AgentName;
}
public void setAgentName(String agentName)
{
AgentName = agentName;
}
public String getAgentAddress()
{
return AgentAddress;
}
public void setAgentAddress(String agentAddress)
{
AgentAddress = agentAddress;
}
public String getAgentPhone()
{
return AgentPhone;
}
public void setAgentPhone(String agentPhone)
{
AgentPhone = agentPhone;
}
public String getUserName()
{
return UserName;
}
public void setUserName(String userName)
{
UserName = userName;
}
public String getSex()
{
return Sex;
}
public void setSex(String sex)
{
Sex = sex;
}
public String getIdNumber()
{
return IdNumber;
}
public void setIdNumber(String idNumber)
{
IdNumber = idNumber;
}
public String getUserPhone()
{
return UserPhone;
}
public void setUserPhone(String userPhone)
{
UserPhone = userPhone;
}
public String getUserAddress()
{
return UserAddress;
}
public void setUserAddress(String userAddress)
{
UserAddress = userAddress;
}
public String getUpassword()
{
return Upassword;
}
public void setUpassword(String upassword)
{
Upassword = upassword;
}
public String getApassword()
{
return Apassword;
}
public void setApassword(String apassword)
{
Apassword = apassword;
}
}
4.数据库连接
package com.Util;标签:return,String,close,void,private,准备,房产,信息管理系统,public From: https://www.cnblogs.com/mendianyu/p/16867615.html
import java.sql.*;
public class util
{
public static Connection getConnection()//连接数据库
{
try{
Class.forName("com.mysql.cj.jdbc.Driver");
//System.out.println("加载驱动成功");
}catch(ClassNotFoundException e)
{
e.printStackTrace();
}
String user="root";
String password="Mendy030628";
String url = "jdbc:mysql://localhost:3306/db1?useSSL=false&serverTimezone=GMT&characterEncoding=utf-8&autoReconnect=true";
Connection con=null;
try{
con= DriverManager.getConnection(url,user,password);
//System.out.println("数据库连接成功");
}catch(SQLException e)
{
e.printStackTrace();
}
return con;
}
//**********************************************************************
//关闭方法
public static void close (Connection con)
{
try{
if(con!=null)
{
con.close();
}
}catch(SQLException e)
{
e.printStackTrace();
}
}
public static void close(PreparedStatement preparedStatement)
{
try{
if(preparedStatement!=null)
{
preparedStatement.close();
}
}catch(SQLException e)
{
e.printStackTrace();
}
}
public static void close(ResultSet resultSet)
{
try{
if(resultSet!=null)
{
resultSet.close();
}
}catch(SQLException e)
{
e.printStackTrace();
}
}
public static void main(String[] args) throws SQLException
{
}
}