このコードは、データベースにデータを格納し、NetBeansプログラムを使用して結果を確認するために作成しました。ただし、出力はなく、コンパイルエラーもありません。何が問題なのかわかりますか?不足しているjarファイルはありますか
package database;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.*;
public class Database {
static Connection conn;
public Database() {
}
public static Connection getConnection() {
return conn;
}
public static void main(String[] args) throws SQLException {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
System.out.println("Could not load the driver");
}
String user = "SYSTEM"; //readEntry("Enter userid: ");
String pass = "mevooo";//readEntry("Enter password: ");
conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", user, pass);
String query = "select Ref, Title,Risk_Rating, Root_cause, Impact, Likelihood, Efforts, Finding, Implication, Recommendation from Lack_Of_Defense ";
PreparedStatement myStatement = conn.prepareStatement(query);
myStatement.clearParameters();
ResultSet myResult = myStatement.executeQuery(query);
while (myResult.next()) {
String Ref = myResult.getString(1);
String Title = myResult.getString(2);
String Risk_Rating = myResult.getString(3);
String Root_cause = myResult.getString(4);
String Impact = myResult.getString(5);
String Likelihood = myResult.getString(6);
String Efforts = myResult.getString(7);
String Finding = myResult.getString(8);
String Implication = myResult.getString(9);
String Recommendation = myResult.getString(10);
System.out.println(" =============================================================");
System.out.println(" ===================== Lack of defense Table ==================");
System.out.println(" Ref : " + Ref);
System.out.println(" Title " + Title);
System.out.println(" Risk Rating " + Risk_Rating);
System.out.println(" Root cause " + Root_cause);
System.out.println(" Impact " + Impact);
System.out.println(" Likelihood " + Likelihood);
System.out.println(" Efforts " + Efforts);
System.out.println(" Finding " + Finding);
System.out.println(" Implication " + Implication);
System.out.println(" Recommendation " + Recommendation);
}
}
}