求一段bean的程序
//数据库的连接
package beans;
import java.sql.*;
public class Conn
{
String DriverName= "com.microsoft.jdbc.sqlserver.SQLServerDriver ";
String Url= "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Mydata ";
String UserName= "sa ";
String PassWord= " ";
public void setDriverName(String newDriverName) {
DriverName = newDriverName;
}
public String getDriverName() {
return DriverName;
}
public void setUrl(String newUrl) {
Url = newUrl;
}
public String getUrl() {
return Url;
}
public void setUser(String newUser) {
UserName = newUser;
}
public String getUser() {
return UserName;
}
public void setPassword(String newPassword) {
PassWord = newPassword;
}
public String getPassword() {
return PassWord;
}
public Connection getConnection() {
try {
Class.forName(DriverName);
return DriverManager.getConnection(Url, UserName, PassWord);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/*public static void main(String[] args)
{
&n