티스토리 뷰
728x90
MySQL JDBC 연결
import java.sql.Connection; import java.sql.DriverManager; public class Test { public static void main(String[] args) throws Exception { Connection conn = null; try { Class.forName("org.gjt.mm.mysql.Driver"); conn = DriverManager.getConnection("jdbc:mysql://localhost:5515/dbname?user=id&useUnicode=true&characterEncoding=UTF8", "id", "pw"); } catch (Exception e) { e.printStackTrace(); if (conn!=null) try { conn.close(); } catch (Exception e2) { } } } }
Oracle thin
import java.sql.Connection; import java.sql.DriverManager; public class Test { public static void main(String[] args) throws Exception { Connection conn = null; try { Class.forName("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "scott", "tiger"); System.out.println(conn); } catch (Exception e) { e.printStackTrace(); if (conn!=null) try { conn.close(); } catch (Exception e2) { } } } }
Oracle OCI
import java.sql.Connection; import java.sql.DriverManager; public class TestOCI { public static void main(String[] args) throws Exception { Connection conn = null; try { Class.forName("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection("jdbc:oracle:oci:@xe", "scott", "tiger"); System.out.println(conn); } catch (Exception e) { e.printStackTrace(); if (conn!=null) try { conn.close(); } catch (Exception e2) { } } } }
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 레이싱모델 익스트림 포토 페스티벌
- Delphi
- ffmpeg
- oracle
- 일본여행
- Spring
- ubuntu
- 지스타2007
- android
- 전예희
- Mac
- flex
- 송주경
- koba2010
- Linux
- BPI-M4
- 동경
- Delphi Tip
- Java
- MySQL
- 서울오토살롱
- 튜닝쇼 2008
- NDK
- sas2009
- KOBA
- SAS
- Spring MVC
- JavaScript
- Xcode
- ble
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
글 보관함