(同じ利用者による、間の3版が非表示) | |||
10行目: | 10行目: | ||
static final String USER = "yoosuke"; | static final String USER = "yoosuke"; | ||
static final String PASSWD = "hoge"; | static final String PASSWD = "hoge"; | ||
public static ArrayList<Item> | public static ArrayList<Item> getRow() { | ||
try (Connection | try (Connection cnc = DriverManager.getConnection(URL, USER, PASSWD);) { | ||
Statement stm = | 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(); ...