Swing student management system Java source code case, swing student management system

Source: Internet
Author: User

Swing student management system Java source code case, swing student management system

Some code is as follows:

package com.student.util;import java.sql.Connection;import java.sql.DriverManager;import java.sql.SQLException;public class DbUtil {        private String dbUrl="jdbc:mysql://localhost:3306/db_student";        private String user="root";        private String password="123456";        private String jdbcName="com.mysql.jdbc.Driver";        public Connection getCon() throws Exception{                Class.forName(jdbcName);                Connection con=DriverManager.getConnection(dbUrl, user, password);                return con;        }        public void close(Connection con)throws Exception{                if(con!=null){                        con.close();                }        }        public static void main(String[] args){                Connection con=null;                try {                        con = new DbUtil().getCon();                        System.out.println(con);                } catch (Exception e) {                        e.printStackTrace();                }finally{                        if(con!=null){                                try {                                        con.close();                                } catch (SQLException e) {                                        e.printStackTrace();                                }                        }                }        }}

  
<Ignore_js_op>

<Ignore_js_op>

<Ignore_js_op>

Http://java.662p.com/thread-3620-1-1.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.