📄 metatest.java
字号:
/*
* Created on 2004-8-9
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.sanshang.jdbc;
/**
* @author WTQ
*
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/
import java.sql.*;
public class MetaTest {
public static void main(String args[]) throws ClassNotFoundException,
SQLException {
Connection conn = null;
try {
// Load database driver
Class.forName(DBInfo.driver);
// Make connection
conn = DriverManager.getConnection(DBInfo.dbURI, DBInfo.user,
DBInfo.password);
// Get the database meta data
DatabaseMetaData dmd = conn.getMetaData();
// Display information about the database
// product and driver
if (dmd == null) {
System.out.println("Database meta data not available");
} else {
System.out.println("Database Product Name : "
+ dmd.getDatabaseProductName());
System.out.println("Database Product Version: "
+ dmd.getDatabaseProductVersion());
System.out.println("Database Driver Name : "
+ dmd.getDriverName());
System.out.println("Database Driver Version : "
+ dmd.getDriverVersion());
}
} finally {
if (conn != null) {
try {
conn.close();
} catch (SQLException sqlEx) {
// ignore
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -