DB接続メモ(大雑把に書きました)
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
Connection con;
preparedStatment pstmt;
ResultSet ts;
//1.DBと接続
con = DriverManager.getConnection(
"jdbc:mysql://(DBのアドレス)",
"(sqlid)",
"(sqlpassword)"
);
//2.dbとやり取りする
pstmt = don.prepareStatement(sql文);
//3.selectb分の実行と結果を代入
rs.pstmt.executeQuery();
//4.結果を表示
while(rs.next()){
}catcg(SQLException e){
e.printStackTrace();
}fainally{
DBのclose処理
}