본문 바로가기

jdbc

[Scala] Scalikejdbc 시작 #1 ScalikeJDBCJust write SQL and get things done! http://scalikejdbc.org/ 를 보면 scalikejdbc는 ScalikeJDBC is a tidy SQL-based DB access library for Scala developers 라고 설명하고 있다. 즉, scala에서 JDBC를 쉽게 사용할 수 있도록 도와주는 Library 이다. scalikejdbc는 다음의 Dependencies 가지고 있다. JDBC Drivers you need Commons DBCP Joda Time 2.x SLF4J API 내가 사용할 JDBC driver와 Commons DBCP를 기본 베이스로 하고 있다. 그리고 JodaTime, SLF4J를 사용한다. 1.Simp.. 더보기
DB2 Data Type Java Mapping Data types that map to database data types in Java applicationsTo write efficient JDBC and SQLJ programs, you need to use the best mappings between Java™ data types and table column data types.The following tables summarize the mappings of Java data types to JDBC and database data types for a DB2® for Linux, UNIX, and Windows, DB2 for z/OS®, or IBM® Informix® system.Data types for updating table.. 더보기
PreparedStatement batch insert (JDBC) 웹개발하면서 DB의 사용은 필연적이기 때문에 java.sql.PreparedStatement의 사용은 필연적이다. Statement도 있기는 하지만 PreparedStatement는 한번 사용한 SQL문이저장되기 때문에 반복해서 사용할 경우 성능이 좋기 때문에 일반적으로는 PreparedStatement를 사용한다. ?123456StringBuffer sql = new StringBuffer(" INSERT INTO poll (col1, col2 ) VALUES (?, ?) "); psmt = conn.prepareStatement(sql.toString());psmt.setString(1, "test");psmt.setString(2, "test");psmt.executeUpdate(); 일반적으로 위.. 더보기