You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.0 KiB
Java

6 months ago
import com.Ineb.Dguard.*;
import com.Ineb.Exception.DguardLoginException;
import com.Ineb.Exception.DguardNetworkException;
import com.Ineb.Exception.DGuardPropertyException;
import java.io.*;
import java.sql.*;
public class PGSQLDec {
static final String DB_URL = "jdbc:postgresql://10.22.170.25:5432/miracle";
static final String USERNAME = "miracle";
static final String PASSWORD = "q!fvYOP^evn";
public static void main(String[] args) {
DguardManager dm = null;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rset=null;
try{
dm = DguardManager.Init("miraclefunding", "Agent!1700", "Agent!1700", "/home/inebsoft/javaapi/conf/dguard.conf");
conn = DriverManager.getConnection(DB_URL,USERNAME,PASSWORD);
conn.setAutoCommit(false);
System.out.println("- PostgreeSQL Connection");
String selectSql = "SELECT id, seyfert_guid FROM admin_model";
pstmt = conn.prepareStatement(selectSql.toString());
rset = pstmt.executeQuery();
while(rset.next()){
int id = rset.getInt("id");
String data01 = rset.getString("seyfert_guid");
System.out.print("ID : " + id + "\n");
System.out.print("DATA : " + data01 + "\n");
String decdata01 = dm.Decrypt("TBL", "ENC", data01);
System.out.print("DEC : " + decdata01 + "\n");
}
rset.close();
pstmt.close();
conn.close();
}catch(SQLException se1){
se1.printStackTrace();
}catch(Exception ex){
ex.printStackTrace();
}finally{
try{
if(pstmt!=null)
pstmt.close();
}catch(SQLException se2){
}
try{
if(conn!=null)
conn.close();
}catch(SQLException se){
se.printStackTrace();
}
}
System.out.println("- PostgreeSQL Connection Close");
}
}