반응형 프로젝트/JAVA10 java Statement 자바에서 디비 조회 java Statement 자바에서 디비 조회 mysql 기준 1. 디비 연결 - 연결 성공시 mysql 연결 ...을 출력한다. public class DBDataTest { static String driver = "jdbc:mysql://123.123.123.1:포트/디비명?characterEncoding=utf8"; static String user = "testId"; static String passwd = "testPasswd"; Statement stat = null; ResultSet rs = null; private static Connection connectionDB() throws Exception{ System.out.println("mysql 연결 ..."); return Dr.. 2022. 11. 11. java split작동 안할때 Stginr testSplit = "abc.defg"; // "\\.".또는 "[.]" 로 해본다. Stginr testSplit1 = testSplit.split("\\.")[0]; Stginr testSplit2 = testSplit.split("[.]")[1]; System.cut.println("testSplit1 : " + testSplit); System.cut.println("testSplit1 : " + testSplit1); System.cut.println("testSplit2 : " + testSplit2); 출력 testSplit1 : abc.defg testSplit1 : abc testSplit2 : defg java split작동 안할때 split이 작동하지 않을때 \\원하는문.. 2022. 11. 9. JAVA split특정문자 자르기 JAVA split특정문자 자르기 1. 문자열을 원하는 문자기준으로 자른다. 예 String auth = aaa,bbb,ccc auth.split(","); 2.문자열을 원하는 문자기주능로 자르면서 배열에 넣는다. 예 String auth = aaa,bbb,ccc String[] authArr = auth.split(","); 2022. 10. 25. JAVA 1초당 1회 출력 (Timer) JAVA 1초당 1회 출력 (Timer) 1~100 까지 1초에 한번씩 콘솔 출력 Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { if(xxx < 100) { System.out.println("i@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ = "+xxx); xxx +=1; } else { timer.cancel(); } } }, 0, 1000); 결과 i@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ = 0 . . . . . . i@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ = 99 2022. 9. 23. 이전 1 2 3 다음 반응형