一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

通用数据库操作BEAN

时间:2022-07-02 18:21:40 编辑:袖梨 来源:一聚教程网

通用数据库操作BEAN
package pkgCDB;
import java.text.*;
import java.util.*;
import java.sql.*;
public class clsCDB
{
String sDBDriver = "";
String sConnStr = "";
String sHint = "";
ResultSet rs = null;
Connection conn = null;
Statement stmt = null;
public String getHint()
{
return sHint;
}
public void setDBDriver(String s)
{
sDBDriver = "" + s;
}
public String getDBDriver()
{
return sDBDriver;
}
public String getConnStr()
{
return sConnStr;
}
public void setConnStr(String s)
{
sConnStr = "" + s;
}
public ResultSet getResultSet()
{
return rs;
}
//Initialize the database
public boolean Initialization(String dbDrive,String dbConn)
{
sDBDriver = dbDrive;
sConnStr = dbConn;
return Initialization();
}
public boolean Initialization()
{
try
{
Class.forName(sDBDriver);
sHint = "Initialization sucessfully"; return true;
}
catch(java.lang.ClassNotFoundException e) {
sHint = "Initialization : " + e.getMessage();
return false;
}
}
//A common function perhaps usable
public String chkStr(String inStr)
{
StringBuffer result = new StringBuffer("");
char cc;
if (inStr != null)
{
for (int i = 0; i < inStr.length(); i++)
{
cc = inStr.charAt(i);
if (cc == )
{
result.append();
}
result.append(cc);

热门栏目