⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbmanager.java

📁 jsp网站开发四“酷”全书原码
💻 JAVA
字号:
package com.publish.shop.util.db;import java.sql.*;import com.publish.shop.util.javabeans.Debug;import com.publish.shop.util.javabeans.ShopException;public class DbManager{  /**   * @param sql   * @return int   * @throws PmmvsException   */  public static int executeUpdate(String sql) throws Exception  {    Debug.println("update,delete,insert: "+sql);    int rs = 0;    Connection con = null;    Statement stmt = null;    try    {      con = DbPool.getConnection();      stmt = con.createStatement();      rs = stmt.executeUpdate(sql);      con.commit();    }    catch(Exception sqlEx)    {      throw sqlEx;    }    finally    {      DbPool.closeStatement(stmt);      DbPool.closeConnection(con);    }    return rs;  }  /**   * @param sql   * @return int   * @throws PmmvsException   */  public static int executeUpdate(Connection con, String sql) throws Exception  {    Debug.println("update: " + sql);    int rs = 0;    Statement stmt = null;    try    {      stmt = con.createStatement();      rs = stmt.executeUpdate(sql);    }    catch(Exception sqlEx)    {      throw sqlEx;    }    finally    {      DbPool.closeStatement(stmt);    }    return rs;  }  public static String replaceString(String str)  {    if (str!=null && str.length()>0)    {      str = str.replace('*', '&');      str = str.replace('?', '-');    }    return str;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -