티스토리 뷰
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="javax.naming.*" %>
<%@ page import="javax.sql.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.net.*" %>
<%
Context ctx = null;
DataSource ds = null;
Connection conDs = null;
Statement stmt = null;
ResultSet rs = null;
try {
//localbinding lookup1
/*
Context initContext = new InitialContext();
ctx = (Context)initContext.lookup("java:comp/env");
ds = (DataSource)ctx.lookup("yerin_cloud");
*/
/*
//localbinding lookup2
Context initContext = new InitialContext();
ds = (DataSource)initContext.lookup("java:comp/env/test");
conDs = ds.getConnection();
*/
//global binding lookup - jndi서버를 통한 resource lookup임.
ctx = new InitialContext();
ds = (DataSource) ctx.lookup("myDataSource");
conDs = ds.getConnection();
stmt = conDs.createStatement();
String query = " select 'Connect Success!!!' from dual ";
out.println("query : "+query+" ");
rs = stmt.executeQuery( query );
while (rs.next()) {
out.print("result : " +rs.getString(1));
}
} catch ( Exception e ) {
e.printStackTrace();
} finally {
if ( stmt != null ) try { stmt.close(); } catch(Exception e) {}
if ( conDs != null ) try { conDs.close(); } catch(Exception e) {}
}
%>
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 아두이노스토리
- 우테캠
- coding
- 표준프레임워크 배치 jar
- JBR-2732
- IntelliJ
- CODINGARRAYKIT
- jeus8
- SI
- JsonMergePatch
- shortkey
- TMK
- code vision
- 서비스회사
- Arduino
- JsonPatch
- 2020.1
- 코딩어레이키트
- 우테캠프로
- code mining
- 이직
- 코딩입문
- 12FactorApp
- 코딩
- 2020.09
- CONDINGARRAY
- intellij느려짐
- 표준프레임워크 배치
- 아두이노
- JBR-526
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
글 보관함