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

📄 connectionmanage.java~1~

📁 这是一个‘常见问题’的功能
💻 JAVA~1~
字号:
package com.accp.s2t68.jun.customerregister.server.dao;

import java.sql.*;
public class ConnectionManage {
  public static Connection getConnection()
  {
    Connection conn = null;
    try {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    }
    catch (ClassNotFoundException ex) {
    }
    try {
      conn = DriverManager.getConnection("jdbc:odbc:Customer");
    }
    catch (SQLException ex1) {
    }
    return conn;
  }

  public static void close(Connection conn) {
    try {
      if (!conn.isClosed())
        conn.close();
    }
    catch (SQLException ex) {
      System.out.println(ex.toString());
    }
  }

  public static void close(ResultSet rs)
  {
    if(rs!=null)
      try {
        rs.close();
      }
      catch (SQLException ex) {
      }
  }

  public static void close(Statement st)
  {
    if(st!=null)
      try {
        st.close();
      }
      catch (SQLException ex) {
      }
  }
}

⌨️ 快捷键说明

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