📄 dbconnection.java
字号:
//package com.chinamobile.db;
//
//import java.sql.*;
//
//public class DBConnection {
// private Connection conn;
// private Statement stmt;
// private ResultSet rs;
//
// public DBConnection() {
// try {
// Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
// public Connection getConnection() {
// try {
// conn = DriverManager.getConnection(
// "jdbc:sqlserver://localhost:1049;DatabaseName=ChinaMobile ",
// "sa", "123");
// } catch (Exception e) {
// e.printStackTrace();
// }
// return conn;
// }
//
// public void closeAll() {
// try {
// if (rs != null) {
// rs.close();
// }
// if (stmt != null) {
// stmt.close();
// }
// if (conn != null) {
// conn.close();
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
// public ResultSet executeQuery(String sql) throws SQLException {
// conn = getConnection();
// stmt = conn.createStatement();
// rs = stmt.executeQuery(sql);
// return rs;
// }
//
// public int executeUpdate(String sql) throws SQLException {
// conn = getConnection();
// stmt = conn.createStatement();
// int i = stmt.executeUpdate(sql);
// return i;
// }
//
// public int executeUpdate(String[] sql) throws SQLException {
// conn = getConnection();
// stmt = conn.createStatement();
// conn.setAutoCommit(false);
// int count = 0;
// for (int i = 0; i < sql.length; i++) {
// System.out.println(sql[i]);
// count += stmt.executeUpdate(sql[i]);
// }
// conn.commit();
// conn.setAutoCommit(true);
// return count;
// }
//}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -