Resources
-
Consumer 인터페이스를 사용해 DB연결하기(+ try-with-resources , 람다 )JAVA/스트림, 컬렉션 프레임워크, 람다 2024. 6. 20. 12:18
▤ 목차" data-ke-type="html">HTML 삽입미리보기할 수 없는 소스 ✔DB와 연결하기우선 db와 연동할 것이기에 mariadb 파일을 build path를 해준 후 진행하자. 💻 코드로 보기public class MyLambda5Db { public MyLambda5Db() { //db연결 try { Class.forName("org.mariadb.jdbc.Driver"); } catch (Exception e) { System.out.println("Driver loding fail : " + e); return; } //메서드 호출 (람다 사용) queryTable("select * from sangdata", rs -> { tr..