|
闲来无事,读到一个jsp jdbc连接oracle的文章《JSP JDBC(Thin模式)连接Oracle》,他写的连接池代码不错,就拿来一试,帖子具体内容在http://www.mscto.com/JSP/04406203.html 这个链接下。跑来跑去,代码跑不下去了,追来追去,原来在下边的方法中出错了
/**
* 创建新的连接
*/
private Connection newConnection() {
System.out.println("---Connection newConnection()-----" + URL + dbInfo);
Connection con = null;
try {
con = DriverManager.getConnection(URL+dbInfo);
log("连接池" + name + "创建一个新的连接");
} catch (SQLException e) {
log(e, "无法创建下列URL的连接: " + URL);
return null;
}
return con;
}
URL+dbInfo格式不对,DriverManager.getConnection方法按照常规的参数格式为
DriverManager.getConnection(url,user,password),本人才疏学浅,这个帖子在google一搜,估计地100条了,不知道这个帖子什么时候发表的,时过境迁,别人没人质疑,有精通的请联系我,谢谢。 |
|
|