package com.org.words;
import java.sql.*;
import java.util.Date;
import java.text.*;
import java.lang.*;
public class Excute_DB
{
private Connection dbConn=null;
private Statement stmt=null;
private ResultSet rs=null;
public void Excute_DB() throws Exception{
try{
dbConn=(Connection)DbPool.getConnection();
stmt=dbConn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);}
catch(Exception e)
{
e.printStackTrace();
throw e;
} }
public String getSystemTime(){
Date date=new Date();
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return df.format(date);
}
public int query_total(String strSql) throws Exception
{
try{
rs =stmt.executeQuery(strSql);
rs.last();
return rs.getRow();
}
catch(Exception e)
{
e.printStackTrace();
throw e;
}
}
public boolean In_DelExcute(String strSql) throws Exception
{
try
{
stmt.executeUpdate(strSql);
return true;
}
catch(Exception e)
{
e.printStackTrace();
throw e;
}
finally {
stmt.close();
dbConn.close();
}
}
public ResultSet QueryExcute(String strSql) throws Exception
{
try
{
rs =stmt.executeQuery(strSql);
return rs;
}
catch(Exception e)
{
e.printStackTrace();
throw e;
}
}
}