输入banner图图片脚本导航/分类

JDBC

public static Connection getConnection() throws Exception {
        // 1. ???????????? 4 ?????.
        // 1). ???? Properties ????
        Properties properties = new Properties();

        // 2). ??? jdbc.properties ???????????
        InputStream in = JDBCTools.class.getClassLoader().getResourceAsStream(
                "jdbc.properties");

        // 3). ???? 2?? ???????????
        properties.load(in);

        // 4). ??????? user, password ??4 ?????.
        String user = properties.getProperty("user");
        String password = properties.getProperty("password");
        String jdbcUrl = properties.getProperty("jdbcUrl");
        String driver = properties.getProperty("driver");

        // 2. ?????????????(????? Driver ??????????????????????.)
        Class.forName(driver);

        // 3. ??? DriverManager ?? getConnection() ???????????????.
        return DriverManager.getConnection(jdbcUrl, user, password);
    }

JDBC

标签: