package com.allClass.SQL;
import com.allClass.Database.DatabaseConnection;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class PersonalInfo {
private Connection con = null;
private Statement st = null;
private ResultSet rs = null;
private DatabaseConnection dbc = new DatabaseConnection();
public String getCurrentLoginInfo() {
boolean flag = true;
String loginInfoString = "";
String query = "";
this.con = this.dbc.connectDB();
if (this.con == null) {
flag = false;
loginInfoString = null;
}
if (flag) {
try {
this.st = this.con.createStatement();
query = "SELECT PKG_DRPATCAREQUERY.FNC_TODATE(SYSDATE) logInDateTime FROM DUAL";
this.rs = this.st.executeQuery(query);
while (this.rs.next()) {
loginInfoString = this.rs.getString("logInDateTime").trim();
}
} catch (SQLException sq) {
loginInfoString = null;
sq.printStackTrace();
try {
this.rs.close();
this.st.close();
this.con.close();
} catch (SQLException ex) {
loginInfoString = null;
ex.printStackTrace();
}
} finally {
try {
this.rs.close();
this.st.close();
this.con.close();
} catch (SQLException ex) {
loginInfoString = null;
ex.printStackTrace();
}
}
}
return loginInfoString;
}
}
No comments:
Post a Comment