일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- MySQL
- Exception
- JavaScript
- STS
- Thymeleaf
- IntelliJ
- jpa
- Open Source
- 오픈소스
- error
- myBatis
- Python
- 문서
- Eclipse
- SpringBoot
- git
- 설정
- maven
- Spring Boot
- Core Java
- ubuntu
- AJAX
- spring
- oracle
- MSSQL
- Source
- JDBC
- PostgreSQL
- Docker
- Tomcat
- Today
- Total
목록Core Java (61)
헤르메스 LIFE
프로그램의 Runtime 시에 외부프로그램을 수행시킬 필요가 있습니다. 아래의 프로그램을 사용해서 "Notepad.exe"를 실행시켜 보겠습니다. package example.ext; import java.io.IOException; public class NotepadExec { public static void main(String[] args) throws Exception { runNotepad(); } static Runtime rt = Runtime.getRuntime(); public static void runNotepad() throws IOException { Process notepad = rt.exec("notepad.exe"); notepad.waitFor(); // Notepad..
프로젝트를 진행하면서 몇 분 및 몇 초 단위로 어떤 Application을 실행시켜야할 경우가 생깁니다. Thread를 공부하면서 한번 만들어 봤습니다... 참고하세요... ^^* 주의해야 할 점은, Runtime을 이용해서 Java 애플리케이션을 실행시키면 실행이 되는지 그 결과를 알 수 없습니다. 그래서 InputStream을 이용해서 읽어서 출력해야 합니다. package example.threadtest; public class ThreadTest { public static void main(String[] args) { ThreadDeamon thread = new ThreadDeamon(); thread.start(); } } package example.threadtest; import j..
엄청 큰 숫자형의 연산은 BigDecimal 형으로 변경 후 계산을 하면 좋습니다. import java.math.BigDecimal; public class Test { public static void main(String[] args) { BigDecimal bdcl1 = new BigDecimal("12345678901234567899"); BigDecimal bdcl2 = new BigDecimal("12345678901234567890"); // 더하기 BigDecimal p_add = bdcl1.add(bdcl2); // 빼기 BigDecimal p_sub = bdcl1.subtract(bdcl2); // 곱하기 BigDecimal p_mul = bdcl1.multiply(bdcl2); //..
Oracle 에서 입력된 stored procedure 를 java에서 실행해서 결과를 얻고 싶으시다면Statement 대신에 CallableStatement 라는걸 쓰시면 됩니다. 그 뒤에는 어차피 insert, update 같은 것들과 같이 성공 또는 실패, 성공시 몇개가 성공했는지,query 인 경우에는 ResultSet 받아서 fetch 하면서 값 뽑아서 쓰시면 됩니다.Connection 까지는 똑같고 그 다음부터가 약간 다른데 대충 아래와 같습니다. // 위에서 JDBC 드라이버 잡고 Connection 까지 맺은 상태...CallableStatement cs = con.prepareCall("{call myStoredProcedure(?,?,?)}");cs.setInt(1,2);cs.reg..
홈페이지 : http://nexcel.sourceforge.net/ 다운로드 : http://www.andykhan.com/jexcelapi/download.html API : http://www.andykhan.com/jexcelapi/ import java.io.File; import java.io.FileNotFoundException; import jxl.Cell; import jxl.CellType; import jxl.Sheet; import jxl.Workbook; public class JxlTest { public static void main(String[] args) { try { File file_1 = new File("c:\test.xls"); // Excel파일을 읽음. Wor..
Name of JDBC Driver : Driver Version : Major Version : Minor Version : Database Product Name : Database Product Version Version : Database Major Version: Database Minot Version:
출처 : http://blog.naver.com/hazard11?Redirect=Log&logNo=80028745174 HttpURLConnection으로 특정 주소에 접근하는 경우를 종종 볼수 있습니다. 해당 웹서버/WAS 에서 요청헤더의 특정 값이 필요한 경우, 이를 세팅해주어야하며, 응답헤더에서 내려오는 특정 값이 필요한 경우, 해당 값을 가져와야합니다.. final public static String PUT = "Cookie"; final public static String GET = "Set-Cookie"; public static void main(String[] args) { HttpURLConnection con = null; String line = null; String cookie..
import java.io.*; import java.sql.*; import java.util.*; import java.util.Date; public class DBConnectionManager { static private DBConnectionManager instance; // The single instance private Vector drivers = new Vector(); private PrintWriter log; private Hashtable pools = new Hashtable(); private Hashtable clients = new Hashtable(); /** * A private constructor since this is a Singleton */ privat..
출처 : docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html Date Format Pattern Syntax You can design your own format patterns for dates and times from the list of symbols in the following table: SymbolMeaningPresentationExample G era designator Text AD y year Number 2009 M month in year Text & Number July & 07 d day in month Number 10 h hour in am/pm (1-12) Number 12 H hour in day (0..
출처 : http://www.edankert.com/validate.html Configure Java APIs (SAX, DOM, dom4j, XOM) using JAXP 1.3 to validate XML Documents with DTD and Schema(s).Many Java XML APIs provide mechanisms to validate XML documents, the JAXP API can be used for most of these XML APIs but subtle configuration differences exists. This article shows five ways of how to configure different Java APIs (including DOM, S..