?? dbmetademo.java
字號(hào):
/*
* DBMetaDemo.java
*
* Created on 2007年12月22日, 上午9:48
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package happychat;
import java.net.*;
import java.sql.*;
/**
*
* @author 范方青
*/
public class DBMetaDemo {
public static void main(String [] args){
String url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=test";
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con = DriverManager.getConnection(url,"sa","123456");
DatabaseMetaData dma = con.getMetaData();
System.out.println("連接到URL:"+dma.getURL());
System.out.println("驅(qū)動(dòng)程序名"+dma.getDriverName());
System.out.println("驅(qū)動(dòng)程序版本:"+dma.getDriverVersion());
// System.out.println("JDBC主版本:"+dma.getJDBCMajorVersion());
// System.out.println("JDBC次版本:"+dma.getJDBCMinorVersion());
System.out.println("最大連接數(shù):"+dma.getMaxConnections());
System.out.println("\n數(shù)據(jù)庫(kù)名:"+dma.getDatabaseProductName()+dma.getDatabaseProductVersion());
System.out.println("數(shù)據(jù)庫(kù)是否支持外部連接:");
if(dma.supportsOuterJoins())
System.out.println("是");
else
System.out.println("否");
con.close();
}
catch(SQLException e){
e.printStackTrace();
}
catch(Exception ex){
ex.printStackTrace();
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -