• JdbcTool


    public class JdbcTools {

    private static Connection con;
    private static String url;
    private static String user;
    private static String pwd;
    public static Connection getConnection(){
    //第一步加载驱动
    try {
      Class.forName("org.gjt.mm.mysql.Driver");
      url = "jdbc:mysql://localhost:3306/119";
      user = "root";
      pwd = "123";
    //第二步创建连接
      con = (Connection) DriverManager.getConnection(url, user, pwd);
      con.setAutoCommit(false);
      } catch (ClassNotFoundException e) {
    // TODO Auto-generated catch block
      e.printStackTrace();
      } catch (SQLException e) {
    // TODO Auto-generated catch block
      e.printStackTrace();
      }
      return con;
      }
    }

  • 相关阅读:
    Linux基础优化(二)
    权限
    分页
    序列化
    forms
    redis
    Django缓存机制
    跨域问题
    Django的ORM
    模板层
  • 原文地址:https://www.cnblogs.com/VCandy/p/5475520.html
Copyright © 2020-2023  润新知