Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.Statement;
- public class Base {
- public ResultSet rs;
- public String usuario,pass,categoria;
- public Connection conexion = null;
- public Statement s;
- public void AvtivarDriver(){
- try{
- Class.forName("com.mysql.jdbc.Driver");
- }catch(Exception e){
- //exception
- }
- }
- public void ConexionDB(){
- try{
- conexion = DriverManager.getConnection("jdbc:mysql://localhost/datos","root","labtel");
- }catch(Exception e){
- //exception
- }
- }
- public void PeticionCategoria(String U, String P){
- try{
- s = conexion.createStatement();
- rs = s.executeQuery("SELECT * FROM usuarios WHERE nombre=\""+U+"\" AND password=\""+P+"\"");
- rs.next();
- this.usuario = rs.getString("nombre");
- this.pass = rs.getString("password");
- this.categoria = rs.getString("categoria");
- }catch(Exception e){
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement