| 12行目: | 12行目: | ||
public static ArrayList<Item> getRow() { | public static ArrayList<Item> getRow() { | ||
try (Connection | try (Connection con = DriverManager.getConnection(URL, USER, PASSWD);) { | ||
Statement s = | Statement s = con.createStatement(); | ||
... | ... | ||
2019年6月28日 (金) 20:02時点における版
私は一連の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 con = DriverManager.getConnection(URL, USER, PASSWD);) {
Statement s = con.createStatement();
...