Background Image
응용개발
2009.04.15 04:16

jdbc에서 질의 플랜정보 보는 방법

조회 수 15840 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
JDBC 프로그램에서 질의 플랜정보 보는 방법

CUBRID는  JDBC 프로그램에서 질의 플랜을 출력해주는 메소드를 제공한다.
cubrid.conf 설정

플랜이 출력되려면 CUBRID 설정파일인 $CUBRID/conf/cubrid.conf에 optimization_level=513을 추가하고 DB 서버를 재시작하여야 한다.

# Enable Java Stored Procedure
java_stored_procedure=no
optimization_level=513

간단 예제
다음은 질의 플랜을 화면에 출력하는 간단 예제이다.

import java.sql.*;
import cubrid.jdbc.driver.*; //CUBRIDStatement를 사용하기 위해 import 해야 함.
public class getQueryplan{
        public static void main(String arg[]) throws Exception {
                Connection        conn = null;
                ResultSet         rs = null;
                PreparedStatement  pstmt = null;               
                try {
                        Class.forName("cubrid.jdbc.driver.CUBRIDDriver");
                        conn = DriverManager.getConnection("jdbc:cubrid:localhost:53000:demodb:::","","");
                        conn.setAutoCommit(false); //플랜 정보를 가져오기 위해서는 auto commit을 false로 설정해야 함.
                        String sql = "select host_nation from olympic where host_year = ?";
                        pstmt = conn.prepareStatement(sql);
                        pstmt.setInt(1, 2004);
                        ((CUBRIDStatement)pstmt).setQueryInfo(true);                
                        rs = pstmt.executeQuery();
                        String plan = ((CUBRIDStatement)pstmt).getQueryplan(); // 수행한 질의 플랜 정보를 가져오는 메소드.
                        while(rs.next())
                            System.out.println("host_nation : " + rs.getString(1));
                        conn.commit();
                        System.out.println("plan : " + plan);               
                }catch ( SQLException e ) {
                        e.printStackTrace();
                }catch ( Exception e ) {
                        e.printStackTrace();
                }finally {
                        if (rs != null) rs.close();
                        if (pstmt != null) pstmt.close();
                        if (conn != null) conn.close();
                }
        }
}




  1. PHP PEAR extension Cache-Lite 를 이용한 응용 프로그램 최적화

    Date2009.07.01 Category응용개발 By웁쓰 Views17044
    Read More
  2. PHP PEAR extension 을 이용한 DB Time 추적

    Date2009.07.01 Category응용개발 By웁쓰 Views19185
    Read More
  3. PHP 성능 최적화를 위한 고려 사항

    Date2009.07.01 Category응용개발 By웁쓰 Views17416
    Read More
  4. PHP에서 prepared statement 사용시 BIND 관련 팁

    Date2009.06.30 Category응용개발 ByPrototype Views14843
    Read More
  5. cubrid_fetch_all() php 함수로 만들어 사용하기

    Date2009.06.30 Category응용개발 By시난 Views18619
    Read More
  6. Java Data Type의 CUBRID Data Type으로의 변경 Tip

    Date2009.06.16 Category응용개발 Bycubebridge Views18032
    Read More
  7. ODBC 드라이버를 이용한 Prepare 사용하기.

    Date2009.06.16 Category응용개발 Byseongjoon Views19591
    Read More
  8. PHP에서 prepared statement 사용하기

    Date2009.04.16 Category응용개발 ByPrototype Views21454
    Read More
  9. jdbc에서 질의 플랜정보 보는 방법

    Date2009.04.15 Category응용개발 By손승일 Views15840
    Read More
  10. jdbc에서 bit 데이터 타입 사용하기

    Date2009.04.11 Category응용개발 By손승일 Views15013
    Read More
  11. CUBRID 에서 제공하는 ODBC 함수 목록

    Date2008.11.21 Category응용개발 Byadmin Views26052
    Read More
  12. Attempt to access a closed ResultSet(PreparedStatement) 오류

    Date2008.11.21 Category응용개발 Byadmin Views28035
    Read More
  13. loadjava 사용 시 inner class 로딩은 어떻게?

    Date2008.11.21 Category응용개발 Byadmin Views27450
    Read More
  14. tomcat 5.5 버전 이상에서 dbcp(커넥션 풀링) 설정법

    Date2008.11.21 Category응용개발 Byadmin Views28527
    Read More
  15. embedded sql 에서 char 사용시 주의 사항

    Date2008.11.21 Category응용개발 Byadmin Views19008
    Read More
  16. 응용프로그램에서 질의 처리시 commit/rollback 처리 문제

    Date2008.11.21 Category응용개발 Byadmin Views21600
    Read More
Board Pagination Prev 1 2 3 Next
/ 3

Contact Cubrid

대표전화 070-4077-2110 / 기술문의 070-4077-2113 / 영업문의 070-4077-2112 / Email. contact_at_cubrid.com
Contact Sales