javabean连接数据库出错问题

usaspy 2004-10-09 11:12:13
private String url = "jdbc:weblogic:mssqlserver4:";
private String serverName = "VICTORY"; //缺省配置参数
private String portNumber = "1433";
private String databaseName = "bbs";
private String userName = "sa";
private String password = "3989632";

private java.sql.Connection con = null;
private Statement stmt = null;
private Statement stmtNum = null;
private PreparedStatement pstmt = null;
private ResultSet rs = null;
private int resultNum = 0;
private ResultSet countRs = null;
private int rsNum = 0;
public int stateNum1;


/** 构造函数 **/
public OpenDb() {
stateNum1 = 1;
try{
con = java.sql.DriverManager.getConnection(getConnectionUrl(),userName,password);
stmt = con.createStatement();
}catch(Exception e){
e.printStackTrace();
System.out.println("数据库连接错误 : " + e.getMessage());
}


}

private String getConnectionUrl(){
return url + databaseName + "@" + serverName;
}


如上一段连接数据库的程序段,我用jdbc连接sqlserver,平台是weblogic,但是老提示出错“数据库连接错误 : No suitable driver”
...全文
87 点赞 收藏 1
写回复
1 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
duan123 2004-10-09
没有加载数据库驱动程序
回复
发动态
发帖子
Web 开发
创建于2007-09-28

7.9w+

社区成员

Java Web 开发
申请成为版主
社区公告
暂无公告