基于Java获取Mysql表结构的方法 Class.forName("com.mysql.jdbc.Driver").newInstance();Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/MALL?user=rootpassword=123456");DatabaseMetaData meta = (DatabaseMetaData) conn.ge
基于Java获取Mysql表结构的方法Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = DriverManager .getConnection("jdbc:mysql://localhost:3306/MALL?user=root&password=123456"); DatabaseMetaData meta = (DatabaseMetaData) conn.getMetaData(); ResultSet rs = meta.getColumns(null, "%", "T_Mall_ReturnOrderInfo", "%"); while (rs.next()) { // table catalog (may be null) String tableCat = rs.getString("TABLE_CAT"); // table schema (may be null) String tableSchemaName = rs.getString("TABLE_SCHEM"); // table name String tableName_ = rs.getString("TABLE_NAME"); // column name String columnName = rs.getString("COLUMN_NAME"); // SQL type from java.sql.Types int dataType = rs.getInt("DATA_TYPE"); // Data source dependent type name, for a UDT the type name is // fully qualified String dataTypeName = rs.getString("TYPE_NAME"); System.out.println(columnName + " " + dataTypeName); // table schema (may be null) int columnSize = rs.getInt("COLUMN_SIZE"); // the number of fractional digits. Null is returned for data // types where DECIMAL_DIGITS is not applicable. int decimalDigits = rs.getInt("DECIMAL_DIGITS"); // Radix (typically either 10 or 2) int numPrecRadix = rs.getInt("NUM_PREC_RADIX"); // is NULL allowed. int nullAble = rs.getInt("NULLABLE"); // comment describing column (may be null) String remarks = rs.getString("REMARKS"); // default value for the column, which should be interpreted as // a string when the value is enclosed in single quotes (may be // null) String columnDef = rs.getString("COLUMN_DEF"); // int sqlDataType = rs.getInt("SQL_DATA_TYPE"); // int sqlDatetimeSub = rs.getInt("SQL_DATETIME_SUB"); // for char types the maximum number of bytes in the column int charOctetLength = rs.getInt("CHAR_OCTET_LENGTH"); // index of column in table (starting at 1) int ordinalPosition = rs.getInt("ORDINAL_POSITION"); // ISO rules are used to determine the nullability for a column. // YES --- if the parameter can include NULLs; // NO --- if the parameter cannot include NULLs // empty string --- if the nullability for the parameter is // unknown String isNullAble = rs.getString("IS_NULLABLE"); // Indicates whether this column is auto incremented // YES --- if the column is auto incremented // NO --- if the column is not auto incremented // empty string --- if it cannot be determined whether the // column is auto incremented parameter is unknown String isAutoincrement = rs.getString("IS_AUTOINCREMENT"); System.out.println(tableCat + "-" + tableSchemaName + "-" + tableName_ + "-" + columnName + "-" + dataType + "-" + dataTypeName + "-" + columnSize + "-" + decimalDigits + "-" + numPrecRadix + "-" + nullAble + "-" + remarks + "-" + columnDef + "-" + sqlDataType + "-" + sqlDatetimeSub + charOctetLength + "-" + ordinalPosition + "-" + isNullAble + "-" + isAutoincrement + "-"); } conn.close();
?

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于结构化数据处理开源库SPL的相关问题,下面就一起来看一下java下理想的结构化数据处理类库,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于PriorityQueue优先级队列的相关知识,Java集合框架中提供了PriorityQueue和PriorityBlockingQueue两种类型的优先级队列,PriorityQueue是线程不安全的,PriorityBlockingQueue是线程安全的,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于java锁的相关问题,包括了独占锁、悲观锁、乐观锁、共享锁等等内容,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于多线程的相关问题,包括了线程安装、线程加锁与线程不安全的原因、线程安全的标准类等等内容,希望对大家有帮助。

本篇文章给大家带来了关于Java的相关知识,其中主要介绍了关于关键字中this和super的相关问题,以及他们的一些区别,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于枚举的相关问题,包括了枚举的基本操作、集合类对枚举的支持等等内容,下面一起来看一下,希望对大家有帮助。

封装是一种信息隐藏技术,是指一种将抽象性函式接口的实现细节部分包装、隐藏起来的方法;封装可以被认为是一个保护屏障,防止指定类的代码和数据被外部类定义的代码随机访问。封装可以通过关键字private,protected和public实现。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于设计模式的相关问题,主要将装饰器模式的相关内容,指在不改变现有对象结构的情况下,动态地给该对象增加一些职责的模式,希望对大家有帮助。


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

DVWA
Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

MinGW - Minimalist GNU for Windows
這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。

ZendStudio 13.5.1 Mac
強大的PHP整合開發環境