jsp连接sql server请教 可以用一个连接建立两个Statement 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 创建connection时错误,我查一下 我在DBTools这个类里面建立连接用的下面的方法的,麻烦看看这样建行吗? /**建立数据库连接 *返回数据库连接对象 *@return con */ public static Connection getNewConnection() { try { Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); Connection con=DriverManager.getConnection(dburl); con.setAutoCommit(false); Connection connection = con; return connection; } catch(Exception e) { error("getNewConnection error:"+e.getMessage()); } Connection connection1 = null; return connection1; } /**返回数据库连接对象 * @return con */ public synchronized static Connection getCurCon() { if(binit) { try { if(con.isClosed()) { binit=false; return getCurCon(); } else return con; } catch(Exception e) { error("connection error:"+e.getMessage()); } } con=getNewConnection(); binit=true; return con; } 如果设置了conn.setAutoCommit(false)把它去掉 struts2 自定义的action继承了actionsupport后,方法名称为什么可以自定义,而不是execute? java web后台都用什么框架或技术开发? 跪求中!!jbpm不能持久到数据库中 如何在JSP中获取Struts2的ActionContext ? 一个关于servlet过滤器问题 [散分讨论]页面上多个功能模块隐现、排序如何实现 关于 VSS 和 Jbuilder ····· 数据库统计 spring2.0入门问题 请教:如何在一个htm页面中运行一个Bean 在一个jsp程序里面用来生成树行菜单的问题 如何实现“推荐给朋友”这个功能,即将文章发送到朋友的邮箱中。
/**建立数据库连接
*返回数据库连接对象
*@return con
*/
public static Connection getNewConnection()
{
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con=DriverManager.getConnection(dburl);
con.setAutoCommit(false);
Connection connection = con;
return connection;
}
catch(Exception e)
{
error("getNewConnection error:"+e.getMessage());
}
Connection connection1 = null;
return connection1;
} /**返回数据库连接对象
* @return con
*/
public synchronized static Connection getCurCon()
{
if(binit)
{
try
{
if(con.isClosed())
{
binit=false;
return getCurCon();
}
else
return con;
}
catch(Exception e)
{
error("connection error:"+e.getMessage());
}
}
con=getNewConnection();
binit=true;
return con;
}