请问一个关于数据库连接的问题
代码如下:package fouth;
public class InterfaceTest {
public static void main(String[] args) {
Student astudent=new Student("tom", "123456");
astudent.setAddress("beijing");
astudent.setSex("men");
System.out.println(astudent);
}
}
interface Person{
String getName();
String getSex();
String getBirthday();
String getAddress();
int setAddress(String strAddress);
}
class Student implements Person,Comparable{
private String strName="";
private String strSex="";
private String strNumber="";
private String strBirthday="";
private String strSpeciality="";
private String strAddress="";
public String getSex() {
return strSex;
}
public void setSex(String strSex) {
this.strSex = strSex;
}
public String getBirthday() {
return strBirthday;
}
public void setBirthday(String strBirthday) {
this.strBirthday = strBirthday;
}
public String getSpeciality() {
return strSpeciality;
}
public void setSpeciality(String strSpeciality) {
this.strSpeciality = strSpeciality;
}
public String getAddress() {
return strAddress;
}
public String getName() {
return strName;
}
public String getNumber() {
return strNumber;
}
public Student(String strName, String strNumber) {
super();
this.strName = strName;
this.strNumber = strNumber;
}
public String toString(){
String information="学生姓名="+strName+",学号="+strNumber;
if(!strSex.equals("")){
information+=",性别="+strSex;
}
if(!strBirthday.equals("")){
information+=",出生年月="+strBirthday;
}
if(!strSpeciality.equals("")){
information+=",专业="+strSpeciality;
}
if(!strAddress.equals("")){
information+=",籍贯="+strAddress;
}
return information;
}
public int setAddress(String strAddress) {
this.strAddress=strAddress;
return 0;
}
public String getStrAddress() {
return strAddress;
}
@Override
public int compareTo(Object o) {
// TODO Auto-generated method stub
return 0;
}
}
报错如下
java.sql.SQLException: The url cannot be null
at java.sql.DriverManager.getConnection(DriverManager.java:554)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at eight.DoUpdateTest.getStudent(DoUpdateTest.java:23)
at eight.DoUpdateTest.main(DoUpdateTest.java:19)
能创建表,但是不能输出表
请问这是为什么,地址不存在为空啊!