add
This commit is contained in:
@@ -18,7 +18,7 @@ public class DBUtil {
|
||||
// 四大金刚
|
||||
String dname = Utils.getPeoperties("dbname")+"";
|
||||
String driver = "com.mysql.jdbc.Driver";// 驱动名称
|
||||
String url = "jdbc:mysql://127.0.0.1:"+Utils.getPeoperties("dbport")+"/"+dname+"?useUnicode=false&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&autoReconnect=true&useSSL=false";// 连接
|
||||
String url = "jdbc:mysql://"+Utils.getPeoperties("dburl")+":"+Utils.getPeoperties("dbport")+"/"+dname+"?useUnicode=false&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&autoReconnect=true&useSSL=false";// 连接
|
||||
String username = Utils.getPeoperties("dbusername")+"";// 用户名
|
||||
String password = Utils.getPeoperties("dbpassword")+"";// 密码
|
||||
|
||||
@@ -258,4 +258,27 @@ public class DBUtil {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检查某个表是否存在
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public boolean cktable(String name){
|
||||
boolean is = false;
|
||||
try {
|
||||
|
||||
this.getConnection();// 获得连接对象
|
||||
ResultSet tables = this.con.getMetaData().getTables(null, null, name, null);
|
||||
if (tables.next()) is = true;
|
||||
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
this.close(this.rs, this.pstmt, this.con);
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user