jdbc连接数据库 class.froname

try{

Class.forName("com.mysql.jdbc.Driver");

conn=DriverManager.getConnection(url,username,password);

System.out.println("连接数据库成功");

}catch(Exception e){

e.printStackTrace();

System.out.println("建立数据库发生错误!");

}finally{

return conn;

}

class.forname这句话,不要好像也可以运行啊,这话什么意思,可以不要吗

不要你确定可以运行并且连接到数据库?