1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      Oracle讀取庫中表結(jié)構(gòu)

      (學(xué)習(xí)記錄)

      我們提供的服務(wù)有:網(wǎng)站設(shè)計制作、成都網(wǎng)站設(shè)計、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、榆陽ssl等。為上千多家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的榆陽網(wǎng)站制作公司

      代碼中Table類與Field類請參照:http://meijia.blog.51cto.com/8684191/1563874

      可參考api調(diào)整相關(guān)參數(shù)。

      (同樣注意格式)

      1. 方法如下

      public List

      export() {

              List

      tableList = new ArrayList
      ();

              

                  Connection conn = DBUtil.getConnection();

                  ResultSet tableRs = null; // 存庫元數(shù)據(jù)

                  ResultSet colRs = null;//存儲表元數(shù)據(jù)

              try {

                  DatabaseMetaData dbmd = conn.getMetaData();//返回連接到的數(shù)據(jù)庫此 Connection 對象所連接的數(shù)據(jù)庫的元數(shù)據(jù)

                  //獲取所有表

                  List tableNameList = new ArrayList();

                  tableRs = dbmd.getTables(null, "%", "%", new String[]{"TABLE"}); //所有表

                  while (tableRs.next()) {

                      String tableName = tableRs.getString("TABLE_NAME");//表名

                      tableNameList.add(tableName);

                  }

                  List fieldList = null;//存儲每一個表的所有字段

                  Table table = null;

                  for (String name : tableNameList ) {

                      table = new Table();

                      //獲取表的字段

                      colRs = dbmd.getColumns(null, "%", name, "%");//當(dāng)前表的字段

                      Field field = null;

                      fieldList = new ArrayList();

                      while (colRs.next()) {

                          field = new Field();

                          String columnName = colRs.getString("COLUMN_NAME");//名稱

                          String columnType = colRs.getString("TYPE_NAME");//類型

                          int datasize = colRs.getInt("COLUMN_SIZE");//字段長度

                          int digits = colRs.getInt("DECIMAL_DIGITS");

                          int nullable = colRs.getInt("NULLABLE");//返回1就表示可以是Null,而0就表示Not Null

                          field.setColumnName(columnName);

                          field.setTypeName(columnType);

                          field.setColumnSize(datasize);

                          field.setDecimal_digits(digits);

                          field.setNullable(nullable);

                          fieldList.add(field);

                      }

                      table.setTableName(name);

                      table.setField(fieldList);

                      tableList.add(table);

                  }

              } catch (SQLException ex) {

                  Logger.getLogger(ExportOracleTable.class.getName()).log(Level.SEVERE, null, ex);

              } finally {

                  if(colRs != null) {

                      try {

                          colRs.close();

                      } catch (SQLException ex) {

                          Logger.getLogger(ExportOracleTable.class.getName()).log(Level.SEVERE, null, ex);

                      }

                  }

                  if(tableRs != null) {

                      try {

                          tableRs.close();

                      } catch (SQLException ex) {

                          Logger.getLogger(ExportOracleTable.class.getName()).log(Level.SEVERE, null, ex);

                      }

                  }

                  if(conn != null) {

                      try {

                          conn.close();

                      } catch (SQLException ex) {

                          Logger.getLogger(ExportOracleTable.class.getName()).log(Level.SEVERE, null, ex);

                      }

                  }

              }

              return tableList;

          }


      文章題目:Oracle讀取庫中表結(jié)構(gòu)
      URL分享:http://ef60e0e.cn/article/jhsssd.html99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
          1. <ul id="0c1fb"></ul>

            <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
            <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

            潜江市| 项城市| 三河市| 福清市| 柘城县| 安塞县| 昆明市| 商都县| 桐乡市| 桦川县| 黄冈市| 九江县| 辽阳县| 垦利县| 新沂市| 永济市| 天长市| 凯里市| 家居| 横峰县| 沙河市| 门源| 许昌县| 桓仁| 泗洪县| 齐齐哈尔市| 井研县| 盐池县| 吉隆县| 钟山县| 民县| 虹口区| 黄龙县| 黔东| 新丰县| 梁平县| 台南市| 高雄县| 长葛市| 凭祥市| 黎平县|