:: JDBC 드라이버 복사
C:\oraclexe\app\oracle\product\11.2.0\server\jdbc\lib 폴더 안에 ojdbc6_g.jar 파일을
C:\Java\jre1.8.0_162\lib\ext 로 복사
:: 간단한 사용 예시
C:\oraclexe\app\oracle\product\11.2.0\server\jdbc\lib 폴더 안에 ojdbc6_g.jar 파일을
C:\Java\jre1.8.0_162\lib\ext 로 복사
:: 간단한 사용 예시
Connection connection;
Statement statement;
ResultSet resultSet;
String driver = "oracle.jdbc.driver.OracleDriver";
String url = "jdbc:oracle:thin:@localhost:1521:xe";
String uid = "publicvoid";
String upw = "privatevoid";
String query = "select * from void_members";
try {
Class.forName(driver);
connection = DriverManager.getConnection(url, uid, upw);
statement = connection.createStatement();
resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String id = resultSet.getString("user_id");
String pw = resultSet.getString("user_pw");
String name = resultSet.getString("user_name");
String mobile = resultSet.getString("user_mobile");
out.println("아이디 : " + id + " / 패스워드 : " + pw + " / 이름 : " + name + " / 휴대전화 : " + mobile);
}
} catch (Exception exception) {
exception.printStackTrace();
} finally {
try {
if (resultSet != null) resultSet.close();
if (statement != null) statement.close();
if (connection != null) connection.close();
} catch (Exception exception2) {
exception2.printStackTrace();
}
}