showdatabasemetadata.java
来自「本套光盘提供了本书各章实例的所需的部分源程序文件以及数据库文件。读者 需要使用」· Java 代码 · 共 50 行
JAVA
50 行
import java.sql.*;
public class ShowDatabaseMetaData {
public static void main(String[] args) {
Connection conn = null;
try {
conn = ConnectionManager.getConnection();
DatabaseMetaData md = conn.getMetaData();
System.out.println("Information about the database: ");
System.out.println("Database name=[" + md.getDatabaseProductName()
+ "]");
System.out.println("Database version=["
+ md.getDatabaseProductVersion() + "]");
System.out.println("Driver name=[" + md.getDriverName() + "]");
System.out.println("Driver version=[" + md.getDriverVersion()
+ "]");
System.out
.println("Supports forward only ResultSet=["
+ md.supportsResultSetType(ResultSet.TYPE_FORWARD_ONLY)
+ "]");
System.out
.println("Supports scroll sensitive ResultSet=["
+ md.supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE)
+ "]");
System.out
.println("Supports scroll insensitive ResultSet=["
+ md.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE)
+ "]");
System.out
.println("Supports updatable ResultSet=["
+ md.supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE)
+ "]");
System.out.println("Supports ANSI92 entry=["
+ md.supportsANSI92EntryLevelSQL() + "]");
System.out.println("Supports ANSI92 intermediate=["
+ md.supportsANSI92IntermediateSQL() + "]");
System.out.println("Supports ANSI92 full=["
+ md.supportsANSI92FullSQL() + "]");
} catch (Exception e) {
e.printStackTrace();
}
finally {
ConnectionManager.close(conn);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?