일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- PostgreSQL
- top
- rsync
- docker
- mysql
- oracle
- 리눅스
- API
- 차이점
- Javascript
- MongoDB
- JPA
- SQL
- 트랜잭션
- IntelliJ
- network
- 명령어
- spring
- Python
- Linux
- 오블완
- DBMS
- 티스토리챌린지
- 자바
- mssql
- group by
- git
- MariaDB
- java
- analytics4
- Today
- Total
목록JAVA (46)
hanker
String to Date (String → Date) String에서 Date로 형변환 SimpleDateFormat transFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date to = transFormat.parse("Date로 변환할 String Data"); Date to String (Date → String) Date에서 String으로 형변환 SimpleDateFormat transFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String to = transFormat.format("String으로 변환할 Date data");
pom.xml에 org.json 을 추가한다. org.json json 20180130 json 추가가 완료되면 테스트 코드를 작성한다. import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import org.apache.commons.io.IOUtils; import org.json.JSONObject; import org.json.XML; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; public class xmltoJson { public static vo..
public static void zipDirectory(String dir, String zipfile) throws IOException, IllegalArgumentException{ //파일리스트 가져오기 위해 객체 생성 File d = new File(dir); //디렉토리 존재유무 if(!d.isDirectory()) throw new IllegalArgumentException("Not a directory : " + dir); //해당 경로의 파일을 배열로 가져옴 String[] entries = d.list(); //파일 복사를 위한 버퍼 byte[] buffer = new byte[4096]; int bytesRead; //zip파일을 생성하기 위한 객체 생성 ZipOutputStrea..
- ssh Keygen 등록되었다는 가정하에 소스 (기존 ssh 명령어를 통해 외부서버 접속 시 password 입력을 해야하지만 keygen 등록 시 패스워드 없이 서버 접속가능) (ssh keygen 등록 시) public static void main(String ar[]) throws Exception{ String execStr = "ssh 접속서버계정@서버IP Command"; // ex) "ssh test@1.1.1.1 rm -r /data/reData/text.txt"; Process ps = Runtime.getRuntime().exec(execStr); ps.getErrorStream(); ps.getInputStream(); ps.getOutputStream(); ps.waitFor(..
admin.disableTable("테이블 명"); admin.deleteTable("테이블 명");
void rename(Admin admin, String oldTableName, TableName newTableName) { String snapshotName = randomName(); admin.disableTable("기존 테이블 명"); admin.snapshot("TMP 테이블 명", "기존 테이블 명"); admin.cloneSnapshot("TMP 테이블 명", "변경 할 테이블 명"); admin.deleteSnapshot("TMP 테이블 명"); admin.deleteTable("기존 테이블 명"); } - rename 기능이 없기 때문에 파일명 변경 후 복제 → 원본 데이터 명 삭제 참고 : https://hbase.apache.org/book.html#table.rename