public abstract class DataBase
{
protected Map<String ,Connection > connMap = new HashMap<String ,Connection >();
public static String OBJ_TYPE_TABLE="TABLE";
public static String OBJ_TYPE_COLUMN="COLUMN";
public static String OBJ_TYPE_INDEX="INDEX";
public enum DBTYPE
{
ORACLE,HSQL
};
protected String id;
protected String dbType;
protected String add;
protected String dbName;
protected String userName;
protected String password;
protected int port;
/*
* 数据库安全检测
*/
public abstract boolean checkSecurity();
/*
* 创建数据库连接
*/
public abstract Connection getConn(String userName,String password);
/*
* 创建数据库连接
*/
public abstract Connection getConn();
/*
* 清理数据库
*/
public boolean clearDB() throws Exception
{
if (!this.checkSecurity())
{
return false;
}
return true;
}
public String getDbType()
{
return dbType;
}
public void setDbType(String dbType)
{
this.dbType = dbType;
}
public String getDbName()
{
return dbName;
}
public void setDbName(String dbName)
{
this.dbName = dbName;
}
public String getUserName()
{
return userName;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getAdd()
{
return add;
}
public void setAdd(String add)
{
this.add = add;
}
public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public int getPort()
{
return port;
}
public void setPort(int port)
{
this.port = port;
}
public abstract Primary_Key getPrimaryKey(SqlRecord record)throws SQLException;
}
{
protected Map<String ,Connection > connMap = new HashMap<String ,Connection >();
public static String OBJ_TYPE_TABLE="TABLE";
public static String OBJ_TYPE_COLUMN="COLUMN";
public static String OBJ_TYPE_INDEX="INDEX";
public enum DBTYPE
{
ORACLE,HSQL
};
protected String id;
protected String dbType;
protected String add;
protected String dbName;
protected String userName;
protected String password;
protected int port;
/*
* 数据库安全检测
*/
public abstract boolean checkSecurity();
/*
* 创建数据库连接
*/
public abstract Connection getConn(String userName,String password);
/*
* 创建数据库连接
*/
public abstract Connection getConn();
/*
* 清理数据库
*/
public boolean clearDB() throws Exception
{
if (!this.checkSecurity())
{
return false;
}
return true;
}
public String getDbType()
{
return dbType;
}
public void setDbType(String dbType)
{
this.dbType = dbType;
}
public String getDbName()
{
return dbName;
}
public void setDbName(String dbName)
{
this.dbName = dbName;
}
public String getUserName()
{
return userName;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getAdd()
{
return add;
}
public void setAdd(String add)
{
this.add = add;
}
public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public int getPort()
{
return port;
}
public void setPort(int port)
{
this.port = port;
}
public abstract Primary_Key getPrimaryKey(SqlRecord record)throws SQLException;
}