IT/Java 107

java - console에 DB데이터 출력(행갯수, 열갯수, 열제목, 데이터), ResultSetMetaData

package com.example.jdbc; import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.ResultSetMetaData;import java.sql.SQLException;import java.sql.Statement; public class JDBCConsole { public static void main(String[] args) {String url = "jdbc:h2:tcp://localhost/~/mydb";String user = "sa";String pwd = "";Connection con = null;Statement stmt = null;ResultS..

IT/Java 2018.11.21

java - url을 통해 가져온 데이터를 DOMParser로 파싱, JSONParser로 파싱

CompanyHandler.javapackage com.example.xml; import java.util.ArrayList;import java.util.List; import org.xml.sax.Attributes;import org.xml.sax.SAXException;import org.xml.sax.helpers.DefaultHandler; public class CompanyHandler extends DefaultHandler { private List list = new ArrayList();private Company company;private StringBuilder sb = new StringBuilder();@Overridepublic void startElement(Strin..

IT/Java 2018.11.21

java - 이메일 보내기 자바코드, GUI 이메일 보내기 코드 (JFrame), 웹페이지에서 이메일 보내기

package com.example.email; import org.apache.commons.mail.EmailException;import org.apache.commons.mail.SimpleEmail; public class SimpleEmailExample { public static void main(String[] args) {// 메일 전송기능 라이브러리 준비// CommonsEmail// http://commons.apache.org/proper/commons-email// ▶ commons-email-1.2.jar// JavaMail// http://javaee.github.io/javamail// ▶ mail.jar// JAF(java activation framework)// ▶ a..

IT/Java 2018.11.19

Java - JUnit 픽스처, setUp, tearDown, Before, After, BeforeClass, AfterClass

User.javapackage com.bean; public class User { private String id; private String name; private String password; public User() { } public User(String id, String name, String password) { this.id = id; this.name = name; this.password = password; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String n..

IT/Java 2018.11.14