12行目: | 12行目: | ||
public static ArrayList<Item> getRow() { | public static ArrayList<Item> getRow() { | ||
try (Connection | try (Connection cnc = DriverManager.getConnection(URL, USER, PASSWD);) { | ||
Statement | Statement stm = cnc.createStatement(); | ||
... | ... |
2019年6月28日 (金) 20:06時点における最新版
私は一連のJDBC(Java DataBase Connectivity)ドライバを管理します。
メソッド
- getConnection - 指定データベースURLへの接続を試みる
例
static final String URL = "jdbc:mysql://localhost:3306/day_results"; static final String USER = "yoosuke"; static final String PASSWD = "hoge"; public static ArrayList<Item> getRow() { try (Connection cnc = DriverManager.getConnection(URL, USER, PASSWD);) { Statement stm = cnc.createStatement(); ...