[java] database

來源:互聯網
上載者:User

Connection 

ResultSet

DatabaseMetaData
    getTables(null, null, null, new String[]{"TABLE"}); //return ResultSet    res.getString("TABLE_NAME")

    getColumns(null, "%", "t_sarray2", "%");     //return ResultSet  res.getString("COLUMN_NAME")

DatabaseMetaData dbmd = con.getMetaData();

1  ResultSet DatabaseMetaData.getTables(String catalog,String schema,String tableName,String []type) ; 

參數:catalog:目錄名稱,一般都為空白.
參數:schema:資料庫名,對於oracle來說就使用者名稱
參數:tablename:表名稱
參數:type :表的類型(TABLE | VIEW)

注意:在使用過程中,參數名稱必須使用大寫的。否則得到什麼東西。

2 ResultSet DatabaseMetaData getColumns(String
catalog,String schema,String tableName,String columnName);

參數catalog : 類別名稱
參數schema : 使用者方案名稱
參數tableName : 資料庫表名稱
參數columnName : 列名稱

3 ResultSet DatabaseMetaData getPrimaryKeys(String catalog,String schema,String tableName);

參數catalog
: 類別名稱
參數schema : 使用者方案名稱
參數tableName : 資料庫表名稱

c3p0-0.9.1.1.jar
資料庫連接池類,請 import com.mchange.v2.c3p0.ComboPooledDataSource; 定義 ComboPooledDataSource dataSource; 並使用

getConnection()擷取一個 Connection


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.