Apache Derby Eclipse plug-in
1. Derby Eclipse plug-in 다운로드
http://db.apache.org/derby/derby_downloads.html
- derby_core_plugin_10.8.2.zip
- derby_ui_doc_plugin_1.1.3.zip
2. plug-in 설치
- eclipse 종료
- 다운로드 받은 파일 압축 풀고 eclipse/ 밑에 압축 해제
- eclipse 실행
3. java 프로젝트 생성
4. Add Apache Derby Nature
- 프로젝트 마우스 우 클릭 - Apache Derby - Add Apache Derby Nature
5. Start Derby Network Server
- 프로젝트 마우스 우 클릭 - Apache Derby - Start Derby Network Server
6. ij 프롬프트
- 프로젝트 마우스 우 클릭 - Apache Derby - ij (Interactive SQL)
- Console 창에 ij> 프롬프트 실행 됨
7. DB 생성
ij> connect 'jdbc:derby:myDB;create=true';
8. getConnection()
private Connection getConnection() {
Connection conn = null;
try {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
conn = DriverManager.getConnection("jdbc:derby:myDB;create=true");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return conn;
}
9. ij
ij> connect 'jdbc:derby:myDB;create=true';
ij> show schemas;
ij> show tables;
ij> describe table_name;
ij> disconnect;
ij> exit;