Skip to content

Database

Ghost_chu edited this page May 14, 2019 · 1 revision

This a huge part contains 4 classs, so i only write how to use it.

Connect to database

Database db = new MySQLCore(host,user,pass,database,port,max_connections,useSSL);
// Or use SQLite
Database db = new SQLiteCore(dbFile);

Check connection type

if(db instanceof MySQLCore){
//MYSQL
}else if(db instanceof SQLiteCore){
//SQLITE
}else{
//We don't what it is, maybe is a null.
}

Run SQL

db.execute(sql);

PreparedStatement

PreparedStatement ps = db.getConnection().prepareStatement(sql);
...
Clone this wiki locally