package bao;
import java.sql.*;
public class DBManager {
private Connection conn;
private Statement stm;
private ResultSet rs;
public DBManager(){
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:abc");
stm=conn.createStatement();
} catch (Exception e) {
// TODO: handle exception
}
}
public void close(){
try{
conn.close();
}catch(Exception e){
}
}
public void update (String sql){
try {
stm.executeUpdate(sql);
} catch (Exception e) {
// TODO: handle exception
}
}
public ResultSet query(String sql){
try{
rs=stm.executeQuery(sql);
return rs;
} catch (Exception e) {
return null;
}
}
}