客户信息管理系统(说明文档)
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
客户信息管理
一、客户类
package com.my.bean;
//客户类
public class Customer {
private int id;
private String customName;
private String customPassword;
private int age;
private String address;
private String phone;
private String email;
public String getCustomName() {
return customName;
}
public void setCustomName(String customName) {
this.customName = customName;
}
public String getCustomPassword() {
return customPassword;
}
public void setCustomPassword(String customPassword) { this.customPassword = customPassword;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public String toString() {
// TODO Auto-generated method stub
r eturn this.id+"\t"+this.customName+"\t"+this.customPassword+
"\t"+this.age+"\t"+this.address+"\t"+this.phone+"\t"+this.email; }
}
二、数据库连接类
package com.my.db;
import java.sql.*;
//数据库连接类
public class DBCon {
private Connection con;
public Connection getConnection(){
//方法一:JDBC-ODBC桥接
/*try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");//加载注册数据库驱动
con=DriverManager.getConnection("jdbc:odbc:db","sa","sa");//建立连接
} catch (SQLException ex) {
System.out.println("数据库连接不成功!");
ex.printStackTrace();
} catch (ClassNotFoundException ex) {
System.out.println("驱动找不到!");
ex.printStackTrace();
}*/
//方法二:纯粹的JAVA驱动
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");//加载注册数据库驱动
con=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost :1433;databaseName=db","sa","sa");//建立连接
} catch (SQLException ex) {
System.out.println("数据库连接不成功!");
ex.printStackTrace();
} catch (ClassNotFoundException ex) {
System.out.println("驱动找不到!");
ex.printStackTrace();
}
return con;
}
}