?? database.java
字號:
package model.db;import java.sql.*;public class Database { private static final String driver = "com.mysql.jdbc.Driver"; private static final String url = "jdbc:mysql://localhost/store"; private static final String user = "guest"; private static final String password = ""; private static Object driver_obj = null; private static Connection cx = null; public static Connection connect() throws Exception { if (driver_obj == null) { System.out.println("=> load driver"); driver_obj = Class.forName(driver).newInstance(); } if (cx == null || cx.isClosed()) { System.out.println("=> connect"); cx = DriverManager.getConnection(url, user, password); } return cx; }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -