Java/VM環境チェックツール
をテンプレートにして作成
Search in
this wiki
and
or
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
どれもなんてことはないコードなんですけど、コピー&ペー...
*** JavaVMのシステムプロパティを一覧 [#eafa1d71]
webMethodsで、これをJavaサービスにして使っていたものを...
public static final String[][] getSystemProperties() {
Properties props = System.getProperties();
List keyList = new ArrayList(props.keySet());
Collections.sort(keyList);
int propsSize = keyList.size();
String[][] properties = new String[propsSize][2];
for (int i = 0; i < propsSize; i++) {
String key = (String)keyList.get(i);
properties[i][0] = key;
properties[i][1] = props.getProperty(key);
}
return properties;
}
public static final void printlnSystemProperties() {
String[][] sysProps = getSystemProperties();
int propSize = sysProps.length;
for (int i = 0; i < propSize; i++) {
System.out.println(sysProps[i][0] + "=" + sysPro...
}
}
*** VMで有効になっているJDBCドライバのバージョンはどれな...
try {
//Oracle JDBC Driverをロード
DriverManager.registerDriver(new OracleDriver());
//Connectionオブジェクトを作成
Connection conn = DriverManager.getConnection(
"jdbc:oracle:thin:@oracledb:1521:dbn...
"username", "password");
//JDBCおよびDBに関する情報取得
DatabaseMetaData meta = conn.getMetaData();
//DB製品名
String DB_Product_Name = meta.getDatabaseProductName...
//DB製品バージョン
String DB_Product_Version = meta.getDatabaseProductV...
//JDBCドライババージョン
String JDBC_Driver_Name = meta.getDriverName();
//JDBCドライバ製品名
String JDBC_Driver_Version = meta.getDriverVersion();
//Connectionオブジェクトをクローズ
conn.close();
System.out.println("DB_Product_Name: " + DB_Product_...
System.out.println("DB_Product_Version: " + DB_Produ...
System.out.println("JDBC_Driver_Name: " + JDBC_Drive...
System.out.println("JDBC_Driver_Version: " + JDBC_Dr...
} catch (SQLException e) {
e.printStackTrace();
}
終了行:
どれもなんてことはないコードなんですけど、コピー&ペー...
*** JavaVMのシステムプロパティを一覧 [#eafa1d71]
webMethodsで、これをJavaサービスにして使っていたものを...
public static final String[][] getSystemProperties() {
Properties props = System.getProperties();
List keyList = new ArrayList(props.keySet());
Collections.sort(keyList);
int propsSize = keyList.size();
String[][] properties = new String[propsSize][2];
for (int i = 0; i < propsSize; i++) {
String key = (String)keyList.get(i);
properties[i][0] = key;
properties[i][1] = props.getProperty(key);
}
return properties;
}
public static final void printlnSystemProperties() {
String[][] sysProps = getSystemProperties();
int propSize = sysProps.length;
for (int i = 0; i < propSize; i++) {
System.out.println(sysProps[i][0] + "=" + sysPro...
}
}
*** VMで有効になっているJDBCドライバのバージョンはどれな...
try {
//Oracle JDBC Driverをロード
DriverManager.registerDriver(new OracleDriver());
//Connectionオブジェクトを作成
Connection conn = DriverManager.getConnection(
"jdbc:oracle:thin:@oracledb:1521:dbn...
"username", "password");
//JDBCおよびDBに関する情報取得
DatabaseMetaData meta = conn.getMetaData();
//DB製品名
String DB_Product_Name = meta.getDatabaseProductName...
//DB製品バージョン
String DB_Product_Version = meta.getDatabaseProductV...
//JDBCドライババージョン
String JDBC_Driver_Name = meta.getDriverName();
//JDBCドライバ製品名
String JDBC_Driver_Version = meta.getDriverVersion();
//Connectionオブジェクトをクローズ
conn.close();
System.out.println("DB_Product_Name: " + DB_Product_...
System.out.println("DB_Product_Version: " + DB_Produ...
System.out.println("JDBC_Driver_Name: " + JDBC_Drive...
System.out.println("JDBC_Driver_Version: " + JDBC_Dr...
} catch (SQLException e) {
e.printStackTrace();
}
ページ名: