最基础的oracle jdbc语句块

try {
   String jdbcURL ="jdbc:oracle:thin:@fitwsswdb1.nam.nsroot.net:1522:RVDBP1";
   Properties props = new Properties();
   props.put("user", "rvuser");
      props.put("password", "user123");
      props.put("defaultRowPrefetch", "100");
      props.put("defaultBatchValue", "10");
      Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
      Connection smcdbconn = null;
      Statement stmt = null;
      ResultSet rs =null;
      try {
    smcdbconn = DriverManager.getConnection(jdbcURL, props);
    stmt = smcdbconn.createStatement();
    rs=stmt.executeQuery("select * from GXS_ISSUER_ISSUERXREF");
    stmt.setFetchDirection(ResultSet.FETCH_FORWARD);
    stmt.setFetchSize(100);
    int i=0;
    while(rs.next()){
     i++;
    }
   } catch (SQLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   }
  } catch (InstantiationException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (IllegalAccessException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (ClassNotFoundException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }

posted @ 2013-06-12 19:00  爱生活,爱编程  阅读(341)  评论(0编辑  收藏  举报