1. ojdbc8.jar 설치
2. 프로젝트 우클릭 > Java Build Path > Libraries > Add External JARs > ojdbc8.jar추가
3. 프로젝트 우클릭 > Deployment Assembly > Adds > Java Build Path Entries > ojdbc8.jar추가
4. Test
import java.sql.Connection; import java.sql.DriverManager; import org.junit.Test; import lombok.extern.java.Log; @Log public class JDBCTests { static { try { Class.forName("oracle.jdbc.driver.OracleDriver"); } catch (Exception e) { e.printStackTrace(); } } @Test public void testConnection() { try (Connection con = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1522:jun", "아이디", "패스워드" )) { log.info("OK : " + con.toString()); } catch (Exception e) { e.getMessage(); } } }
'WEB > spring' 카테고리의 다른 글
Maven 프로젝트 생성 (0) | 2020.04.28 |
---|---|
AOP예시 (0) | 2020.03.21 |
AOP (0) | 2020.03.21 |
REST 예시 (0) | 2020.02.27 |
HikariCP 커넥션 풀 (0) | 2019.12.30 |